Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
stephencharette-old opened this issue Jun 27, 2023 · 4 comments
Open

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

stephencharette-old opened this issue Jun 27, 2023 · 4 comments

Comments

@stephencharette-old
Copy link

stephencharette-old commented Jun 27, 2023

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)

@jaywcjlove
Copy link
Member

@stephencharette There is no way to reproduce your error.

@stephencharette-old
Copy link
Author

stephencharette-old commented Jun 27, 2023

@jaywcjlove My project is here: https://github.com/stephencharette/_toolkit

If you pull the latest master branch, and try to add the MonacoEditor to client/src/components/Code.js it should give the error

@jaywcjlove
Copy link
Member

@stephencharette I can't run your project. Could not reproduce your error.

@stephencharette-old
Copy link
Author

Please see my monaco branch, you should now be able to run my project without having any firebase credentials. The issue lies in the Library.js file where I am adding in a MonacoEditor component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants