React & Draft.js - convertFromRaw not working : <p>I'm using Draft.js to implement a text editor. I want to save the content of the editor to a DB and later retrieve it and inject it in an editor again, e.g. when revisiting the editor page.</p>

<p><strong>First, these are the relevant imports</strong></p>

<pre><code>import { ContentState, EditorState, convertToRaw, convertFromRaw } from 'draft-js';
</code></pre>

<p><strong>How I Save the Data to the DB (located in a parent Component)</strong></p>

<pre><code>saveBlogPostToStore(blogPost) {
    const JSBlogPost = { ...blogPost, content: convertToRaw(blogPost.content.getCurrentContent())};
    this.props.dispatch(blogActions.saveBlogPostToStore(JSBlogPost));
}
</code></pre>

<p>Now when I check the DB, I get the following Object:</p>

<pre><code>[{"_id":null,"url":"2016-8-17-sample-title","title":"Sample Title","date":"2016-09-17T14:57:54.649Z","content":{"blocks":[{"key":"4ads4","text":"Sample Text Block","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[]}]},"author":"Lukas Gisder-Dubé","__v":0,"tags":[]}]
</code></pre>

<p>So far so good I guess, I tried some other stuff and the Object in the Database is definitely converted. For example, when I save the content without calling the convertToRaw()-method, there are a lot more fields.</p>

<p><strong>Setting the Data as new EditorState</strong></p>

<p>To retrieve the Data from the DB and set it as EditorState, I also tried a lot. The following is my best guess:</p>

<pre><code>constructor(props) {
    super(props);
    const DBEditorState = this.props.blogPost.content;
    console.log(DBEditorState); // logs the same Object as above
    this.state = { ...this.props.blogPost, content: EditorState.createWithContent(
        convertFromRaw(DBEditorState)
    )};
}
</code></pre>

<p>When rendering the component i get the following error:</p>

<pre><code>convertFromRawToDraftState.js:38 Uncaught TypeError: Cannot convert undefined or null to object
</code></pre>

<p>Any help is greatly appreciated!</p>
