-----------------------------------------------
- "useState" related to taking/getting a state and updatingState function for any updating state. Ex: const [count,setCount] = useState(0);
- We can use any "premetive data" or "array object" for useState argument (argument not parameter)
- "premetive data" is more preferable for beginner
- "array object" is difficult to implement and understand the code for a beginner.
- Implemented argument in useState function," "premetive data" or "array object" " return two this such an state and state updating function. Ex: const [count,setCount] = useState(0); //Here , "count" is a state and "setCount" is a state updating function. "0" is a premetive data.
-----------------------------------------------
Best of Luck all of you.....
Thanks to my loving teachers,
Sumit Saha, HM Nayem, Vishwash, Anisul Islam, Rabbil Hasan Rupom
Top comments (2)
useState return two elements array give free to declare state and action ( value / setter ) names, in one step;
Thanks,
I have told here, " such an state and state updating function. " .
I think updating means not only increment or decrement a state but also new value setting in a state.