Hi I have this complex object and I need to create a type or interface for it in my react --typescript-template app
const columnsFromBackend = {
["0"]: {
name: "Terminator Group",
items: [
{
filepath: "0.jpg",
group: "terminator",
id: "0",
isClicked: false,
title: "image_0",
},
{
filepath: "1.jpg",
group: "terminator",
id: "1",
isClicked: false,
title: "image_1",
},
]
}
}
I have tried this
export type Character = {
name: string;
items: {
filepath: string;
group: string;
id: string;
isClicked: boolean;
}
xxxxxxx
const [columns, setColumns] = useState<Character{}>(columnsFromBackend);
but it didn't work?
useState<Character[]>.[]not{}.