import React, { useEffect, useRef } from 'react'; import { JSONEditor, Mode } from 'vanilla-jsoneditor'; import type { JSONEditorPropsOptional } from 'vanilla-jsoneditor'; const Editor: React.FC = (props) => { const editorRef = useRef(null); const container = useRef(null); useEffect(() => { editorRef.current = new JSONEditor({ target: container.current, props: { mode: Mode.text }, }); return () => { editorRef.current?.destroy(); }; }, []); useEffect(() => { editorRef.current?.updateProps(props); }, [props]); return
; }; export default Editor;