Skip to content

Instantly share code, notes, and snippets.

@Katerina198b
Last active December 21, 2021 10:01
Show Gist options
  • Save Katerina198b/b0cb39ea49b74751d08ca209c8382acf to your computer and use it in GitHub Desktop.
Save Katerina198b/b0cb39ea49b74751d08ca209c8382acf to your computer and use it in GitHub Desktop.
Simple draft js and hooks example
import React, {useState} from 'react';
import {Editor, EditorState} from 'draft-js';
const SimpleEditorExample = () => {
const [editorState, setEditorState] = useState(EditorState.createEmpty());
return (
<Editor
editorState={editorState}
onChange={setEditorState}
/>
);
}
ReactDOM.render(
<SimpleEditorExample />,
document.getElementById('target')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment