use hook inside useeffect code example
Example 1: react useeffect
import React, { useEffect } from 'react';
const [data,setData]=useState()
useEffect(() => {
fetch(`put your url/api request in here`)
.then(res=>res.json())
.then(json => setData(json))
},[])
Example 2: react useEffect
import React, { useEffect } from 'react';
export const App: React.FC = () => {
useEffect(() => {
}, [])
return (
<div>Use Effect!</div>
);
}
Example 3: React Hook "useEffect" is called in function
React component names need to start with a capital letter.
That's because React treats components starting with lowercase letters as DOM tags.
Therefore you should name it "Shoes"