You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Blazor/Documentation/docusaurus/docs/razor-component/complex-component-data.md

29 lines
792 B

---
sidebar_position: 4
title: Component appendix classes
---
In order to make our component work we will need several additional classes.
Typically, components are in a `Components` folder, so we'll do the same and create that folder.
As seen in the description, we need to trace user actions, so for that we need a class with the information to trace.
```csharp title="Components/CraftingAction.cs"
public class CraftingAction
{
public string Action { get; set; }
public int Index { get; set; }
public Item Item { get; set; }
}
```
Our component must also accept recipes, so we will create a class representing a recipe.
```csharp title="Components/CraftingRecipe.cs"
public class CraftingRecipe
{
public Item Give { get; set; }
public List<List<string>> Have { get; set; }
}
```