This post to understand how to use state in functional component of React. As we know React has functional and class components and we usually using the Class Components whenever we require to use state of components:
But we also able to use React Hooks to add state into Functional components
Then here we have
dog as state variable and
setDog as the function to update the
useState Hook only allow one state variable being declare at once, in other words if you have multiple state, you should create multiple variables.
Like we using setState in Class components, we are going to use
setDog in Functional components to updated the value of