Search This Blog

Wednesday, September 9, 2020

React hooks

Hooks are basically used in functional components to introduce core
react functionality .. e.g useEffect can call a function once or on a value chang e
useEffect(()=>
{

}
,[what ever value you want to fire this effect on change]);

useState we can use component like state inside the functional components.
they are a life savers when you want to maintain state in functional components.. 
e.g const [ variable, function ]  = useState(null)
Now this will work like a normal state .function .. its awesome..
you can use useRef also to create references... 

No comments:

Post a Comment