mdx-editor / editor

A rich text editor React component for markdown
https://mdxeditor.dev
MIT License
1.63k stars 131 forks source link

[BUG] ERROR Cannot read properties of null (reading 'useMemo') #445

Closed ratheeshaditya closed 2 months ago

ratheeshaditya commented 2 months ago

Hello,

I'm getting started with react, and wanted to create a note taking app. So i decided to use this package(thanks for the valuable contributions you guys making). However, after installing the package, when I am trying to use it I am running into this issue


Cannot read properties of null (reading 'useMemo')
TypeError: Cannot read properties of null (reading 'useMemo')
    at Object.useMemo (http://localhost:3000/static/js/bundle.js:88073:25)
    at RealmWithPlugins (http://localhost:3000/static/js/bundle.js:185730:55)
    at renderWithHooks (http://localhost:3000/static/js/bundle.js:29742:22)
    at mountIndeterminateComponent (http://localhost:3000/static/js/bundle.js:33713:17)
    at beginWork (http://localhost:3000/static/js/bundle.js:35016:20)
    at HTMLUnknownElement.callCallback (http://localhost:3000/static/js/bundle.js:19998:18)
    at Object.invokeGuardedCallbackDev (http://localhost:3000/static/js/bundle.js:20042:20)
    at invokeGuardedCallback (http://localhost:3000/static/js/bundle.js:20099:35)
    at beginWork$1 (http://localhost:3000/static/js/bundle.js:39997:11)
    at performUnitOfWork (http://localhost:3000/static/js/bundle.js:39245:16)

This is my code :-


import {useState, useRef,useEffect} from 'react';
import { MDXEditor, headingsPlugin } from '@mdxeditor/editor'

export default function MarkDown(){
    return (
        <div className="markdown-editor">

            <MDXEditor markdown={'# Hello World'} plugins={[headingsPlugin()]} />

        </div>  

    )
}

And these are my package versions

{
  "name": "researchpal",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.17.0",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "@uiw/react-md-editor": "^4.0.4",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-pdf": "^8.0.0",
    "react-router-dom": "^6.22.3",
    "react-scripts": "^5.0.1",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

Any help in this regard is highly appreciated! :) thanks!

ratheeshaditya commented 2 months ago

EDIT: I am not sure what happened. But i reinstalled the package and it worked! xD