Simple Data Fetching in React with the Fetch API and Axios with Hooks UseEffect and UseState- Beginner Guide :)
In this tutorial, we’ll be learning Simple Data Fetching in React with the Fetch API and Axios with React- Hooks (useEffect and useState)
Before we start please find below the important definitions:
Hooks — Hooks are a new addition in React 16.8. They let you use state and other React features without writing a class.
a)
useState :
is the first “Hook” and TheState Hook
is a Hook that lets you add React state to function componentsb) useEffect : The Effect Hook lets you perform side effects in function components:
“Side Effects ???” — Data fetching, setting up a subscription, and manually changing the DOM in React components are all examples of side effects :)
Hooks are:
Completely opt-in.
100% backward-compatible.
Available now. Hooks are now available with the release of v16.8.0.
Please follow the below link for more details about useEffect and useState