negomi/react-burger-menu

Error: Super expression must either be null or a function, not undefined

Opened this issue · 4 comments

Hello and thank you for your contribution :)

Having used react burger menu in the past, I haven't encountered any problems. However, in a new project, when I do: import { slide as Menu } from "react-burger-menu";

I get the error: Super expression must either be null or a function, not undefined

The project is under Nextjs 13 and React 18.2

How can I solve the problem?

Having this problem too, also using NextJS 13, TypeScript and React 18.2

Hello, the problem has been solved. After searching, you need to use the client component to call React Hooks.

Source : https://nextjs.org/docs/getting-started/react-essentials

Solved
first
install TypeScript types
npm i --save-dev @types/react-burger-menu

then
add 'use client' on top of your component to use the react hooks

I have the same problem next.js 14, let me check the workrounds