React fetch data useEffect hook using axios for easy

 React fetch data useEffect hook using axios for easy



Hello, welcome to my post ,
If your facing your data fetching problem in your application so follow this post and i hope this post will helped.

So first open your project in your any code editor like vscode then create a new component where you will be fetch your data. 
then use this code your component

Now i explain this code first you will be import axios if your have already installed but if your don't have installed this axios first search google axios  then install this package in your application.

Then import this axios example import axios from 'axios';
 And then create a component and write useEffect hook before you will be write useEffect hook first your need import useEffect use this line React,{useState,useEffect} from 'react';


Then if you write this code then set your api response data in your state and you use this data in your view file . if you don't understand how to you will be use so no problem follow the code and use this code .

So this component will work perfectly so if your have any error or any bugs or problem please comment me and if you like this tutorial please share this post .
Thank you so much.
Next Post Previous Post
No Comment
Add Comment
comment url