Skip to content

Cannot read properties of null (reading 'useState') #169

Description

@stephencharette-old

I am getting this error after I npm install and import MonacoEditor into my react functional component.

This is some of my code:
I have version 3.5.8 installed.

`import React, { useState, useContext } from "react";
import MonacoEditor from "@uiw/react-monacoeditor";

<MonacoEditor
value={code}
language={language}
onBlur={handleCodeChange}
onChange={handleCodeType}
options={{
theme: "vs-dark",
}}
/>
`
No matter what options I pass in, as long as MonacoEditor is there, I get this error:

Cannot read properties of null (reading 'useState')
TypeError: Cannot read properties of null (reading 'useState')
at useState (http://localhost:3000/static/js/bundle.js:257147:25)
at MonacoEditor (http://localhost:3000/static/js/bundle.js:64921:70)
at renderWithHooks (http://localhost:3000/static/js/bundle.js:30704:22)
at updateForwardRef (http://localhost:3000/static/js/bundle.js:33275:24)
at beginWork (http://localhost:3000/static/js/bundle.js:35322:20)
at HTMLUnknownElement.callCallback (http://localhost:3000/static/js/bundle.js:20296:18)
at Object.invokeGuardedCallbackDev (http://localhost:3000/static/js/bundle.js:20340:20)
at invokeGuardedCallback (http://localhost:3000/static/js/bundle.js:20397:35)
at beginWork$1 (http://localhost:3000/static/js/bundle.js:40271:11)
at performUnitOfWork (http://localhost:3000/static/js/bundle.js:39518:16)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions