Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

598
Views
Material ui export 'useInsertionEffect' (imported as 'useInsertionEffect$1') was not found in 'react' using Appbar component

here is the error.

1: https://i.stack.imgur.com/Y2Zdo.png**strong text**enter image description here

here i am trying to use Appbar component of material ui but i get this error

over 4 years ago · Santiago Trujillo
6 answers
Answer question

0

I got a similar error, but not with Appbar. I was trying to create my own npm component library with mui v5 components.

ERROR in ./node_modules/comp-lib-mui5-sample/dist/esm/index.js 1293:9-29

export 'useInsertionEffect' (imported as 'e') was not found in 'react' (possible exports: Children, Component, Fragment, Profiler, PureComponent, StrictMode, Suspense, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, cloneElement, createContext, createElement, createFactory, createRef, forwardRef, isValidElement, lazy, memo, useCallback, useContext, useDebugValue, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, version)

Downgrading or upgrading material and emotion, styled did not work.

In my rollup.config.js I had:

{
    input: "src/index.ts",
    output: [
        {
            file: pkg.main,
            format: "cjs",
            sourcemap: true,
        },
        {
           file: pkg.module,
           format: "esm",
           sourcemap: true,
         },
    ],
    plugins: [ //plugins here ],
},
{
    input: "dist/esm/types/index.d.ts",
    output: [{file: "dist/index.d.ts", format: "esm"}],
    plugins: [dts()],
    external: [/\.css$/],
},

esm - esm output is used for building for <script type=module> tag in modern browsers.
cjs – CommonJS, suitable for Node and other bundlers rollup output formats

Fix

New rollup.config.ts that uses only cjs:

{
   ...
    output: [
        {
            file: pkg.main,
            format: "cjs",
            sourcemap: true,
        },
        // REMOVED esm from here
    ],
    plugins: [ //plugins here ],
},
{
    input: "dist/types/index.d.ts", // CHANGED <--dist/esm/types/library.d.ts
    output: [{file: "dist/index.d.ts", format: "esm"}],
    plugins: [dts()],
    external: [/\.css$/],
},

(works with "@emotion/react": "^11.8.2", "@emotion/styled": "^11.8.1", "@mui/material": "^5.5.2")

Sample repositories:
component library Git repo
consumer of the library Git repo
(check README.md for more info.)

over 4 years ago · Santiago Trujillo Report

0

It's possible that there is an error in the latest version of @emotion/react, 11.8.0. It was released 3h ago which would explain why it stopped working all of a sudden.

As a workaround, install the older version @emotion/react@11.7.1 to fix the problems.

over 4 years ago · Santiago Trujillo Report

0

npm install @mui/material@5.4.2 @emotion/react@11.7.1 @emotion/styled@11.6.0 solves everything...

over 4 years ago · Santiago Trujillo Report

0

This issue for other components in mui lib too, you can downgrade emotion/react to 11.7.1 till it's fixed 🚀

over 4 years ago · Santiago Trujillo Report

0

Same happen for me! Downgrading to 11.7.1 fixed!

over 4 years ago · Santiago Trujillo Report

0

This was a bug that was caused by useInsertionEffect being referenced directly in the specifiers list of the import statement (React.useInsertionEffect instead of React['useInsertion' + 'Effect']).

It is fixed as of @emotion/react@11.8.1 - upgrade to that version, and the error should disappear.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!