Skip to content

[React] React is not defined #205

@siamahnaf

Description

@siamahnaf

Hello, @seeden, I am try to use react facebook in my project. But when I add Facebook provider to my project, It throwing an error like this ReferenceError: React is not defined

My Project running with-

  1. Next js
  2. Typescript

The version I am using-
Latest version 9.0.7

<FacebookProvider appId={process.env.NEXT_PUBLIC_FACEBOOK_APP_ID as string}>
        <FacebookLogins />
 </FacebookProvider>

And this is FacebookLogins.tsx Component-

import { useLogin } from 'react-facebook';

export default function LoginExample() {
    const { login, status, isLoading, error } = useLogin();

    async function handleLogin() {
        try {
            const response = await login({
                scope: 'email',
            });

            console.log(response.status);
        } catch (error: any) {
            console.log(error.message);
        }
    }

    return (
        <button onClick={handleLogin} disabled={isLoading}>
            Login via Facebook
        </button>
    );
}

Where I am wrong, How can I solve it.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions