In this react usestate with object tutorial i am going to discuss about how we can use useState react hook with obeject. We can also pass object in useState as parameter. So if you don't know how we can do it, this example is for you.
Hope you know that a Hook is a special function that lets you “hook into” React features. For example, useState
is a Hook that lets you add React state to function components. Hooks are a new addition in React 16.8.
Read also : React Js useState() Hook Example
So now try this above code by running. Hope it can help you. Here we pass ...name to merge the before state value.
#react-hooks #react-js