Question: const useFetchData = ( urlOne ) = > { const [ userData , setuserData ] = useState ( null ) : useEffect ( 0 )

const useFetchData =(urlOne)=>{
const [userData, setuserData]= useState(null):
useEffect (0)=7
axios.get(urlOne)
then((response)=> setUserData(response.data));
(urlOne)):
return [data];
}
export default useFetchData;
What is the use of above custom Hook in the above code?
Assume: All imports are done.
It can fetch data from an API and store it in state.
it can be used across multiple Component at the same time.
It abstracts the data fetch logic.
All of the above
const useFetchData = ( urlOne ) = > { const [

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!