react-codemirror-ts
v0.0.3
Published
Codemirror react wrapper made with typescript
Downloads
768
Maintainers
Readme
react-codemirror-ts
Codemirror react wrapper made with typescript
Installation
npm i react-codemirror-ts
Usage
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 };
License
Refer to LICENSE file