December 2019
Intermediate to advanced
598 pages
12h 21m
English
So, how do we execute logic when a function-based component is rendered? Well, we can use a useEffect hook in React, which is what we are going to do in the following steps:
import { useEffect } from 'react';
export const HomePage = () => { return ( <Page> ... </Page> );};
export const HomePage = () => { useEffect(() => { console.log('first rendered'); }, []); return ( ... );};
Read now
Unlock full access