whats the difference between the following two code i.e,( states in constructor or not) how it works. when do we use one over the other?
class abc extends React.Component {
constructor(props) {
super(props);
this.state = {value: 0};
}
}
Here if I don't specify this though it works
class abc extends React.Component {
state = {
value: 0,
};
}
I'm lil confused can anyone explain please