October 2019
Intermediate to advanced
426 pages
11h 49m
English
In the simple post editor of our blog app, we have a textarea where we can write the contents of a blog post. We are now going to implement the useUndo Hook there, so that we can undo/redo any changes that we made to the text:
> npm install --save use-undo
import useUndo from 'use-undo'
const { value: content, bindToInput: bindContent } = useInput('')
Replace it with the useUndo Hook, as follows. We set the default state to ''. We also save the state to undoContent ...
Read now
Unlock full access