I am back and of course this time it has to do with state! So I know state is not immutable, it can be changed but you only want to change it using setState. If other components need state it also needs to be passed from a parent to child as props. I was going through my udemy lessons, and he did this example of a todo list where you can add new todos. I am confused on some of the code... Here is his full code
First there is this code at the very top. So I know this a destructed function. im assuming hes using this to make it more organized? Because thats being used to map the array.
Then this. So todos is a empty array as state, and on the handleSubmit todos is still an empty array with this.state.todos. and set state is updating the todos ?
One more thing, and I apologize that this has alot of questions, but I need to understand. This line of code. Not sure. I know below this in the full code the todos are getting rendered making li's of whats in the array, but im not sure what this does