Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using with Nextjs 14 #2001

Open
damnitrahul opened this issue Dec 14, 2023 · 3 comments
Open

Using with Nextjs 14 #2001

damnitrahul opened this issue Dec 14, 2023 · 3 comments

Comments

@damnitrahul
Copy link

Describe the bug

Trying to get the basic example running, I am getting this error on Nextjs 14.0.4?
What could be the issue here?

Server Error
Error: Class extends value undefined is not a constructor or null

This might be caused by a React Class Component being rendered in a Server Component, React Class Components only works in Client Components. Read more: https://nextjs.org/docs/messages/class-component-in-server-component

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack
Component
node_modules/react-draggable/build/cjs/DraggableCore.js (73:34)
(rsc)/./node_modules/react-draggable/build/cjs/DraggableCore.js
file:///Users/rahul/Documents/Work/Personal/damnitrahul-v2/.next/server/vendor-chunks/react-draggable.js (30:1)

Your Example Website or App

https://stackblitz.com/edit/stackblitz-starters-mtwkop?description=The%20React%20framework%20for%20production&file=package.json,app%2Fpage.tsx&title=Next.js%20Starter

Steps to Reproduce the Bug or Issue

Copy basic example from the docs
Try to run the example on Nextjs

Expected behavior

It should not throw an error

react-grid-layout library version

1.4.4

Operating System Version

macOS

Browser

Chrome

Additional context

No response

Screenshots or Videos

No response

@medi11
Copy link

medi11 commented Dec 14, 2023

I added "use client", and it seems to be working fine.

@damnitrahul
Copy link
Author

damnitrahul commented Dec 15, 2023

@medi11 I want to use this with SSR

The docs also mention this library is compatible with server-rendered apps

@nandorojo
Copy link

@medi11 I want to use this with SSR

use client does not mean no SSR. use client just means it renders on the client and the server.

use client is the worst naming ever lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants