I am trying to have a child component array in tsx and then add an instance to the array in this code:
import ShoppingList from './ShoppingList';
interface TPState {
shoppingLists2: ShoppingList[];
shoplistsums: number[];
sum: number;
}
class TotalPrice extends React.Component<{}, TPState> {
constructor(props: {}) {
super(props);
this.state = {
shoppingLists2: [ShoppingList],
sum: 0
}
}
but I am getting an error that it is not assignable. I am using the array to add the component on button presses in the page and I am adding the initial item like this. Why is it wrong?