mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-22 23:12:52 +02:00
Replace useMemo with useState in the docs (#5022)
* Replace useMemo with useState * Fix formatting
This commit is contained in:
@@ -17,5 +17,5 @@ The `withHistory` plugin keeps track of the operation history of a Slate editor
|
||||
When used with `withReact`, `withHistory` should be applied inside. For example:
|
||||
|
||||
```javascript
|
||||
const editor = useMemo(() => withReact(withHistory(createEditor())), [])
|
||||
const [editor] = useState(() => withReact(withHistory(createEditor())))
|
||||
```
|
||||
|
@@ -195,7 +195,7 @@ Adds React and DOM specific behaviors to the editor.
|
||||
When used with `withHistory`, `withReact` should be applied outside. For example:
|
||||
|
||||
```javascript
|
||||
const editor = useMemo(() => withReact(withHistory(createEditor())), [])
|
||||
const [editor] = useState(() => withReact(withHistory(createEditor())))
|
||||
```
|
||||
|
||||
## Utils
|
||||
|
Reference in New Issue
Block a user