Questions and answers
Here are some questions and answers to refresh your knowledge:
- What is
useState
?The
useState
hook is a built-in hook in React that allows you to define a state within a functional component and dispatch an action to change it. - What is the most common use of
useState
?The
useState
hook is probably the most common hook in the React hook family. Whenever you need a variable to change UI elements, you can normally resort touseState
to accomplish this. Touching a widget, clicking a vote-up button, hovering over an icon, toggling a checkbox, and much more can be implemented with the use ofuseState
.