1
0
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:
Marton Langa
2019-11-28 23:21:12 +01:00
committed by Ian Storm Taylor
parent 5de91cb4ee
commit 6608a5df39

View File

@@ -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