UI Kit hook useEffect is not defined

Hello community,
I’m trying to build my first Forge app, but I find the following problem:
My app keeps giving me this error: useEffect is not defined

here’s my index.jsx:

import ForgeUI, { render, ProjectPage, Fragment, Text, useEffect } from '@forge/ui';

const App = () => {
    useEffect = (() => {
        console.log('Entered useEffect');
    }, []);

    return (
        <Fragment>
            <Text>Hello world!</Text>
        </Fragment>
    );
};

export const run = render(
    <ProjectPage>
        <App />
    </ProjectPage>
);

Any ideas on what I’m doing wrong?

You are attempting to assign something to useEffect instead of calling the function. Try useEffect(() => ...) instead of useEffect = (() => ...).

3 Likes

Thank you very much, it worked.

1 Like