#ReactHooks #useEffect #useState
=====================
here is the code link - https://github.com/mightyjava/book-re...
for help and support - https://www.buymeacoffee.com/almighty...
=====================
What are React Hooks?
Hooks are a new addition in React 16.8, Hooks let us use state and other React features without writing a class.
Hooks are functions that you hook into React state and lifecycle features from function components.
If you are writing a function component and then you want to add some state to it, previously you do this by converting it to a class component. but now you can do it by using the Hook inside the function component with the help of useState.
Hooks doesn’t work inside the class component.
#useState
The State hook, We call it inside a function component to add some local state to it.
The State hook, returns a pair: the current state and a function that lets you update it, and you can call this function from an event handler or somewhere else and it is like this.setState in a class.
#useEffect
The Effect hook, adds the ability to perform side effects from a function component.
The Effect hook, serves the same purpose as #componentDidMount, #componentDidUpdate, #componentWillUnmount in React classes, but unified into a single API.
Other type of hooks
#useContext, #useReducer, #useCallback, #useMemo, #useRef, #useImperativeHandle, #useLayoutEffect, #useDebugValue