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

Cannot be use with React Server Component #491

Open
Maxwell2022 opened this issue Apr 7, 2023 · 0 comments
Open

Cannot be use with React Server Component #491

Maxwell2022 opened this issue Apr 7, 2023 · 0 comments

Comments

@Maxwell2022
Copy link

Maxwell2022 commented Apr 7, 2023

React Server Side component cannot render class components.

error - node_modules/.pnpm/react-share@4.4.1_react@18.2.0/node_modules/react-share/lib/ShareButton.js (11:18) @ eval
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 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
    at eval (webpack-internal:///(sc_server)/./node_modules/.pnpm/react-share@4.4.1_react@18.2.0/node_modules/react-share/lib/ShareButton.js:14:58)

ShareButton exports a class component

A temporary solution is to add 'use client'; in your custom Share component

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

1 participant