Codemirror react wrapper made with typescript
npm i react-codemirror-ts
import { Codemirror } from 'react-codemirror-ts';
import React, { useState } from 'react';
import 'codemirror/mode/javascript/javascript';
import 'codemirror/addon/edit/matchbrackets';
import 'codemirror/lib/codemirror.css';
function CodemirrorExample() {
const [value, setValue] = useState<string>('');
return (
<Codemirror
defaultValue=""
value=""
name="example"
path="example"
options={{
lineNumbers: true,
lineWrapping: true,
matchBrackets: true,
mode: 'javascript',
tabSize: 2,
}}
onChange={(value, options) => {
setValue(value);
}}
/>
);
}
export { CodemirrorExample };
Refer to LICENSE file