Question: const useFetchData = ( urlOne ) = > { const [ userData , setuserData ] = useState ( null ) : useEffect ( 0 )
const useFetchData urlOne
const userData setuserData useStatenull:
useEffect
axios.geturlOne
thenresponse setUserDataresponsedata;
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
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
