question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improving support for React 18 :)

See original GitHub issue

Improving the support for new React 18

Hi , I am requesting this feature after viewing it on vercel’s (maintainers of Next js) styled jsx library, for more info please take a look at their discussion about it 👍


We can add useInsertionEffect for better hydration & concurrent support 💯 (for more info about useInsertionEffect click here )

  • But this only support in React 18 so we need to implement fallback like below const useInsertionEffect = React.useInsertionEffect || React.useLayoutEffect
    (inspired by Next Js)

I am extremely sorry if I told or made any mistakes 😌

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:9
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
chaudharykirancommented, Apr 18, 2022

Is it working?

Below is my packages:

@emotion/cache@11.7.1 @emotion/react@11.9.0 @emotion/server@11.4.0 @emotion/styled@11.8.1

All the packages are in latest version but I am still getting this error. TypeError: Cannot read property ‘useContext’ of null

Anyhelp will be great.

2reactions
miracle2kcommented, Nov 4, 2021

Here is a repo that shows the current failure when trying to use emotion with next.js 18 / concurrent mode:

https://github.com/miracle2k/next-rsc-demo

TypeError: Cannot read properties of null (reading 'key')
    at insertStyles (webpack://_N_E/./node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js?:19:25)
    at eval (webpack://_N_E/./node_modules/@emotion/react/dist/emotion-element-99289b21.browser.esm.js?:194:75)
    at eval (webpack://_N_E/./node_modules/@emotion/react/dist/emotion-element-99289b21.browser.esm.js?:56:12)
    at renderWithHooks (webpack://_N_E/./node_modules/react-dom/cjs/react-dom-server.browser.development.js?:5212:16)
    at renderForwardRef (webpack://_N_E/./node_modules/react-dom/cjs/react-dom-server.browser.development.js?:5381:18)
    at renderElement (webpack://_N_E/./node_modules/react-dom/cjs/react-dom-server.browser.development.js?:5526:11)
    at renderNodeDestructive (webpack://_N_E/./node_modules/react-dom/cjs/react-dom-server.browser.development.js?:5606:11)
    at renderNode (webpack://_N_E/./node_modules/react-dom/cjs/react-dom-server.browser.development.js?:5722:12)
    at renderHostElement (webpack://_N_E/./node_modules/react-dom/cjs/react-dom-server.browser.development.js?:5197:3)
    at renderElement (webpack://_N_E/./node_modules/react-dom/cjs/react-dom-server.browser.development.js?:5473:5)
error - unhandledRejection: TypeError: Cannot read properties of null (reading 'key')

In addition, there is a different error if you try to use it as part of a server component.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Upgrade to React 18
How to Upgrade to React 18 · Installing · Updates to Client Rendering APIs · Updates to Server Rendering APIs · Updates to...
Read more >
An Ultimate Guide to Upgrading to React 18 - OpenReplay Blog
How to upgrade your React app to take advantage of new features.
Read more >
React 18 Upgrade Guide and New Features - Refine Dev
React 18 was released! Are you looking to upgrade to React 18? Learn about the new features and changes in this comprehensive guide....
Read more >
Upgrading to React 18 with TypeScript - LogRocket Blog
The upgrade of the React type definitions to support React 18 involved some significant breaking changes that developers should know about.
Read more >
Upgrade to react 18 — Issues and resolution - Dev Genius
4. Upgrade react-redux to 8, since redux 8 has support for react 18. In version 8, React Redux's two public APIs ( connect...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found