Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In a README examples, create the initial editor state only once (#140)
The code examples use react state with this example: ``` const [state, setState] = useState(EditorState.create({ schema })); ``` With those examples, on every render, `EditorState.create` will be called. To avoid that, we can use an initializer function ([documentation](https://react.dev/reference/react/useState#avoiding-recreating-the-initial-state)). In our case, we replace with: ``` const [state, setState] = useState(() => EditorState.create({ schema })); ```
- Loading branch information