What is state?
- state is an object which stores data, similar to a variable.
- Using state, we can also update data which is not possible using variable.
Example : Using variable (without state)
In the following example, we want to update data on button click using variable, but data will not get updated because variable cannot update data as mentioned earlier.
GitHub Link :
We need to import useState Hook.
Comments
Post a Comment