React Hooks

What are Hooks in React?

Hooks are functions that let you “hook into” React state and lifecycle features from function components..They let you use state and other React features without writing a class.

Things to know before using hooks in :

You must import hook first

Import it from React.

Hooks can only be called in React Function Components.

Hooks cannot be conditional

Hooks can only be called at the top level of a component, meaning it can't be called from inside a block, i.e. {}.

Tip : React provides a few built-in Hooks like useState. You can also create your own Hooks to reuse stateful behavior between different components.

The most commonly used hooks are :

1.useState Hook

2.useEffect Hook

3.useRef Hook