You should usually just create a new state and use setState to reset the view to that. But if you really want to replace the content, keeping the old undo history and such intact, pass {from: 0, to: editorView.current.state.doc.length, insert: value} under changes.