I am using codemirror and react-codemirror2 to create code editor, I am using the Controlled component once but its showing two editors, When I type on the first editor it is reflecting on the 2nd one
Code:
import "codemirror/lib/codemirror.css";
import "codemirror/theme/eclipse.css";
import "codemirror/mode/javascript/javascript";
import { Controlled as REditor } from "react-codemirror2";
const CreatePolicy = () => {
const [value, setValue] = useState<string>("");
return (
<div className="create-policy-container">
<REditor
className="code-mirror-wrapper"
onBeforeChange={(editor, data, value) => {
setValue(value);
}}
value={value}
options={{
lineWrapping: true,
lint: true,
mode: "css",
theme: "eclipse",
lineNumbers: true,
}}
/>
</div>
);
};
export default CreatePolicy;
I used the same by removing the reactStrictmode and it worked. please someone tell the reason or any alternate way of doing this