0

Everything was working fine in my react app but today after pushing my latest code, I got the below-mentioned error while Github actions were running build to be pushed on ec2.

The error I am facing on running build:

The error I am facing on running build

Attempted import error: 'useInsertionEffect' is not exported from 
'react' (imported as 'useInsertionEffect$1').

Any idea what can be the issue?

I am not facing this on my local machine. I am using react version 17.0.2 and @emotion/react 11.7.1

TBA
  • 1,921
  • 4
  • 13
  • 26
  • 1
    I've never heard of `useInsertionEffect`, but from googling, it seems it's new in React 18 - so it's hardly surprising you're facing an error trying to import it from React v17! – Robin Zigmond Feb 19 '22 at 15:14
  • 1
    yeah, but thing is i am not importing this anywhere in my code. – Mohammad Barjabeen Feb 19 '22 at 16:36
  • I'm facing the similar issue. Yes this looks like a new issue of React18 which is quite new. Also I don't think this is exact duplicate of [another question here which is more specific about the error with Material-UI](https://stackoverflow.com/questions/71185635/material-ui-export-useinsertioneffect-imported-as-useinsertioneffect1-was) – Adil Feb 19 '22 at 17:52
  • So it was an error with `@emotion/react` new update, I solved this by downgrading to `@emotion/react 11.7.1` – Mohammad Barjabeen Feb 20 '22 at 17:21

0 Answers0