-
Notifications
You must be signed in to change notification settings - Fork 27.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error with Draft.js #1722
Comments
Try adding an editorKey="editor" prop. I use draft in a project with next and don't receive any errors. |
The solution @knipferrc presents will work on the next draft-js release since the An easy solution until that happens is to add a |
Thanks all for helping. |
This is my component: import React, { Component } from 'react'
import { Editor, EditorState } from "draft-js";
export default class CHEditor extends Component {
state = { editorState: EditorState.createEmpty() }
onChange = editorState => this.setState(editorState)
render() {
return (
<Editor
editorKey="editor"
onChange={editorState => this.onChange(editorState)}
editorState={this.state.editorState}
placeholder="Simple editor"
/>
)
}
} and I'm still getting same error:
|
@arefaslani, try with this example: Basically create the I tried this quickly and didn't get the error. impronunciable's solution (scroll up) also works to only render the |
@rolfnl in your example you explicitely pass a key to your empty block. This doesn't solve the problem of rendering arbitrary content serverside (and I think it doesn't matter if you provide an However this seems not to be a solution to render content on the server without getting a mismatch (and an error because the client tries to load the wrong keypath from the tree via Or am I missing something? |
Hi,
I'm having an error that makes Draft.js not working correctly with Next.js.
The code is
Thanks
The text was updated successfully, but these errors were encountered: