I am coming over from class styled React components and learning hooks. Can I just use useEffect
how I would would use componentDidMount
lifecycle method? For example, can I import a function and just call it within useEffect()
to mimic how componentDidMount
would work?
import { myFunc } from './importedFuncs';
export default function User() {
useEffect(() => {
myFunc();
});