Last active
December 21, 2021 10:01
-
-
Save Katerina198b/b0cb39ea49b74751d08ca209c8382acf to your computer and use it in GitHub Desktop.
Simple draft js and hooks example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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