Im really having trouble understanding the state in React. Whats the differences between,
This:
class Todo extends ... {
constructor (){
super()
this.state = { ... }
}
}
And This:
class Todo extends ... {
state = { ... }
}
And Im also confused and dumb understanding why theyre putting sometime a function inside state.
const [ user, setUser] = useState(() => ...)
I cant find any resources on differentiating those topics. I hope you can help me explained how and why is that. Ive read blogs about React but they didnt mention those things above.