I was trying to implement a codeMirror in a existing react(with typescript) App. Can anyone please suggest a package that works fine with typescript as well.
I was trying to implement a codeMirror in a existing react(with typescript) App. Can anyone please suggest a package that works fine with typescript as well.
Github: https://github.com/uiwjs/react-codemirror
import React from 'react';
import CodeMirror from '@uiw/react-codemirror';
import { javascript } from '@codemirror/lang-javascript';
function App() {
const onChange = React.useCallback((value, viewUpdate) => {
console.log('value:', value);
}, []);
return (
<CodeMirror
value="console.log('hello world!');"
height="200px"
extensions={[javascript({ jsx: true })]}
onChange={onChange}
/>
);
}
export default App;