Why redux store should be serializable? : <p>When reading the redux doc I found that the doc mentioned this:</p>

<blockquote>
  <p>Still, you should do your best to keep the state serializable. 
  Don't put anything inside it that you can't easily turn into JSON.</p>
</blockquote>

<p>So my question is, what's the benefit of keeping state serializable?
Or, what difficulties I may have if I put non-serializable data into store?</p>

<p>And I believe this is not unique to redux - Flux, even React local state suggest the same thing.</p>

<hr>

<p>To make me clear here is an example. Suppose the store structure is like this.</p>

<pre><code>{
    books: { 
        1: { id: 1, name: "Book 1", author_id: 4 }
    },
    authors: {
        4: { id: 4, name: "Author 4" }
    }
}
</code></pre>

<p>This should all looks good. However when I try to access "the author of Book 1", I have to write code like this:</p>

<pre><code>let book = store.getState().books[book_id];
let author = store.getState().authors[book.author_id];
</code></pre>

<p>Now, I'm going to define a class:</p>

<pre><code>class Book {
    getAuthor() {
        return store.getState().authors[this.author_id];
    }
}
</code></pre>

<p>And my store will be:</p>

<pre><code>{
    books: {
        1: Book(id=1, name="Book 1")
    },
    ...
}
</code></pre>

<p>So that I can get the author easily by using:</p>

<pre><code>let author = store.getState().books[book_id].getAuthor();
</code></pre>

<p>The 2nd approach could make the "book" object aware of how to retrieve the author data, so the caller does not need to know the relation between books and authors. Then, why we are not using it, instead of keeping "plain object" in the store just as approach #1?</p>

<p>Any ideas are appreciated.</p>
