You cannot load an external library which is not supported by React. The editor you want to use has no React compatible component class yet. So If you try to import the file like you import other components, you will get errors.
So for now you have to include the Library as script tag only to use. wait till there is an update from the developer or try another library.
Or take a look at React Json Editor if it serves your purpose.
Answer from Prabodh M on Stack Overflow
» npm install react-json-editor-ajrm
You cannot load an external library which is not supported by React. The editor you want to use has no React compatible component class yet. So If you try to import the file like you import other components, you will get errors.
So for now you have to include the Library as script tag only to use. wait till there is an update from the developer or try another library.
Or take a look at React Json Editor if it serves your purpose.
You can load an external editor in react or any external JS file having Plain Javascript using React.Lazy() .
const MarkdownPreview = lazy(() => import('./MarkdownPreview.js'));
I had a similar issue while trying to Load ace JS editor on to my React app . It got resolved with this .
Just try the require(path).default:
const JSONInput = require('react-json-editor-ajrm').default
and for more details
Did you try this :
import * as JSONInput from "react-json-editor-ajrm";
or
import { JSONInput } from "react-json-editor-ajrm";
If it doesn't work, just tell me and we'll look more into this together :)
Edit for the require :
const JSONInput = require('react-json-editor-ajrm').default