I'm fetching data from an api, and I have a hook which stores the data. I want to render the components after the useEffect hook has fetched data and the data has been set to the data hook. How can I do it?
edit: I need the data before rendering the components.
export const App = () => {
const [data, setData]
useEffect(() => {
axios.get("/data").then((res) => setData(res.data)).catch((err) => console.log(err))
}, [])
return (
<div>
<Home />
</div>
)
}