Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Example in overview section is not working #50

Closed
iroy2000 opened this issue Feb 23, 2016 · 2 comments
Closed

Example in overview section is not working #50

iroy2000 opened this issue Feb 23, 2016 · 2 comments

Comments

@iroy2000
Copy link

http://facebook.github.io/draft-js/docs/overview.html#content

I'm pretty new to this component and want to try it out, so I just basically reuse what is in the overview section.

But the following error is what I get

Cannot read property 'editorState' of null

What suppose to be the initial editor state ?

Since the example just have const {editorState} = this.state;

@iroy2000 iroy2000 changed the title Example in overview is not working Example in overview section is not working Feb 23, 2016
@davisml
Copy link

davisml commented Feb 23, 2016

EditorState.createEmpty() will create an empty EditorState object

@brandondurham
Copy link

If you add this to your component you should be good to go:

export default class YourComponent extends Component {

    state = {
        editorState: EditorState.createEmpty()
    };
    
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants