Skip to content

Commit f451153

Browse files
benatkinVilém Jeniš
authored andcommitted
docs: in react hooks example, limit createEmpty calls (facebookarchive#2432)
Summary: In the React hooks example, `EditorState.createEmpty` will be called each time the component is rendered. By wrapping it in a function, it will only be called once per instance of the MyEditor component. Pull Request resolved: facebookarchive#2432 Reviewed By: claudiopro Differential Revision: D21652207 Pulled By: mrkev fbshipit-source-id: 0c24a4e84718227b4e89d1c810b2558ffd51384d
1 parent 2660a3b commit f451153

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/Overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ import 'draft-js/dist/Draft.css';
7575

7676
function MyEditor() {
7777
const [editorState, setEditorState] = React.useState(
78-
EditorState.createEmpty(),
78+
() => EditorState.createEmpty(),
7979
);
8080

8181
return <Editor editorState={editorState} onChange={setEditorState} />;

0 commit comments

Comments
 (0)