mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-30 10:29:48 +02:00
Remove controlled value state (#3153)
This commit is contained in:
committed by
Ian Storm Taylor
parent
5de91cb4ee
commit
6608a5df39
@@ -250,7 +250,6 @@ Now our commands are clearly defined and you can invoke them from anywhere we ha
|
||||
|
||||
```js
|
||||
const App = () => {
|
||||
const [value, setValue] = useState(initialValue)
|
||||
const editor = useMemo(() => withCustom(withReact(createEditor())), [])
|
||||
const renderElement = useCallback(props => {
|
||||
switch (props.element.type) {
|
||||
@@ -292,10 +291,8 @@ const App = () => {
|
||||
</div>
|
||||
<Editable
|
||||
editor={editor}
|
||||
value={value}
|
||||
renderElement={renderElement}
|
||||
renderMark={renderMark}
|
||||
onChange={newValue => setValue(newValue)}
|
||||
onKeyDown={event => {
|
||||
if (!event.ctrlKey) {
|
||||
return
|
||||
|
Reference in New Issue
Block a user