0
Can someone explain React State or direct towards a tutorial.
2 ответов
+ 3
For useState Hooks,
it returns an array
which should be destructed with
const [stateName, setStateFunction] = useState(initialValue);
Then you can use the state with
{stateName}
in JSX
and you can update the state with
setStateFunction( previousState => {
.....
return newState
});
An (ugly) example :
https://code.sololearn.com/W68LRMG8xig6/?ref=app
+ 1
Do you mean state in Reactjs?