negomi / react-burger-menu

:hamburger: An off-canvas sidebar component with a collection of effects and styles using CSS transitions and SVG path animations
http://negomi.github.io/react-burger-menu/
MIT License
5.04k stars 582 forks source link

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

Open Lazy974 opened 1 year ago

Lazy974 commented 1 year ago

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?

WilliamYuhangLee commented 1 year ago

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

Lazy974 commented 1 year ago

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

khaledmousa95 commented 1 year ago

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

Drakenwolf commented 9 months ago

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