nextjs example seems broken
See original GitHub issueHello,
When I try to run the last version of nextjs example, I get the following error when opening http://localhost:3001:
Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
at resolveDispatcher (react.development.js?aef8:1476)
at useEffect (react.development.js?aef8:1519)
at ExportredTitle (webpack-internal:///./components/exposedTitle.js:19)
at renderWithHooks (react-dom.development.js?f8c1:14985)
at mountIndeterminateComponent (react-dom.development.js?f8c1:17811)
at beginWork (react-dom.development.js?f8c1:19049)
at HTMLUnknownElement.callCallback (react-dom.development.js?f8c1:3945)
at Object.invokeGuardedCallbackDev (react-dom.development.js?f8c1:3994)
at invokeGuardedCallback (react-dom.development.js?f8c1:4056)
at beginWork$1 (react-dom.development.js?f8c1:23964)
at performUnitOfWork (react-dom.development.js?f8c1:22776)
at workLoopSync (react-dom.development.js?f8c1:22707)
at renderRootSync (react-dom.development.js?f8c1:22670)
at performSyncWorkOnRoot (react-dom.development.js?f8c1:22293)
at eval (react-dom.development.js?f8c1:11327)
at unstable_runWithPriority (scheduler.development.js?bacd:468)
at runWithPriority$1 (react-dom.development.js?f8c1:11276)
at flushSyncCallbackQueueImpl (react-dom.development.js?f8c1:11322)
at flushSyncCallbackQueue (react-dom.development.js?f8c1:11309)
at scheduleUpdateOnFiber (react-dom.development.js?f8c1:21893)
at dispatchAction (react-dom.development.js?f8c1:16139)
at checkForUpdates (webpack-internal:///../node_modules/use-subscription/cjs/use-subscription.development.js:85)
at eval (webpack-internal:///../node_modules/next/dist/next-server/lib/loadable.js:307)
at Set.forEach (<anonymous>)
at LoadableSubscription._update (webpack-internal:///../node_modules/next/dist/next-server/lib/loadable.js:306)
at eval (webpack-internal:///../node_modules/next/dist/next-server/lib/loadable.js:286)
The above error occurred in the <ExportredTitle> component:
at ExportredTitle (webpack-internal:///./components/exposedTitle.js:19:51)
at LoadableComponent (webpack-internal:///../node_modules/next/dist/next-server/lib/loadable.js:188:37)
at div
at div
at Home (webpack-internal:///./pages/index.js:44:21)
at MyApp (webpack-internal:///./pages/_app.js:75:24)
at ErrorBoundary (webpack-internal:///../node_modules/@next/react-dev-overlay/lib/internal/ErrorBoundary.js:26:47)
at ReactDevOverlay (webpack-internal:///../node_modules/@next/react-dev-overlay/lib/internal/ReactDevOverlay.js:86:23)
at Container (webpack-internal:///../node_modules/next/dist/client/index.js:155:5)
at AppContainer (webpack-internal:///../node_modules/next/dist/client/index.js:643:24)
at Root (webpack-internal:///../node_modules/next/dist/client/index.js:779:25)
React will try to recreate this component tree from scratch using the error boundary you provided, ErrorBoundary.
logCapturedError @ react-dom.development.js?f8c1:20085
Usually it means that 2 instances of React are used but Module Federation plugin is set up to share React.
Does someone know where it could come from?
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
nextjs example CSS broken in production #21800 - GitHub
Describe the bug. Home page (and probably others) in production have broken styles. To Reproduce Steps to reproduce the behavior:.
Read more >Fix Broken Images in React with Next.js - YouTube
Learn how to create a simple fallback image component for missing or broken images using React and Next.js.
Read more >Advanced Features: Error Handling - Next.js
Error Handling. This documentation explains how you can handle development, server-side, and client-side errors. Handling Errors in Development.
Read more >nextjs - page style not loading initially causing huge icons and ...
I have a page that shows huge icons and pretty much broken css on page load. Followed official nextjs mui5 example.
Read more >What's New in Next.js 13 - AppSignal Blog
In Next.js 13, you can now easily stream parts of the UI to the client with React Suspense. For example, if data fetching...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ScriptedAlchemy I’ve been playing around with you’re plugin (not sure if this is the right form for this kind of question) but I’ve been also experiencing the same issue. You can recreate it by in the example
react-nextjs/nextjs-host-react-remote
example by adding a simpleuseState
hook in theNav
component in remote.https://app.privjs.com/buy/packageDetail?pkg=@module-federation/nextjs-mf