Can someone explain React State or direct towards a tutorial. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone explain React State or direct towards a tutorial.

24th Apr 2020, 3:41 PM
Edward Jackson Jr
Edward Jackson Jr - avatar
2 Answers
+ 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
24th Apr 2020, 4:52 PM
Gordon
Gordon - avatar
+ 1
Do you mean state in Reactjs?
24th Apr 2020, 3:52 PM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar