janoist1 / universal-react-redux-starter-kit

Get started with React, Redux, and React-Router! - With universal rendering!
MIT License
63 stars 9 forks source link

Redux devTools showing state as empty #23

Open kuatro opened 7 years ago

kuatro commented 7 years ago

As I guess, after server-side rendering the client must fill a state from window.___INITIAL_STATE__. But for some reason Redux devTools shows async piece of state as empty. As I understood that means the text on page is only rendered HTML, and state is actually empty?

2017-01-09 18 49 15

bodyno commented 7 years ago

Yean. When you load the specify page. The redux tree will show correct.

kuatro commented 7 years ago

@bodyno sorry?

bodyno commented 7 years ago

Aha?

kuatro commented 7 years ago

Below you can see, that server sends only initial state:

 <script data-react-helmet="true" type="text/javascript">
        ___INITIAL_STATE__ = {
            "router": {
                "locationBeforeTransitions": {
                    "pathname": "/async",
                    "search": "",
                    "hash": "",
                    "state": null,
                    "action": "POP",
                    "key": "5w0791",
                    "query": {},
                    "$searchBase": {
                        "search": "",
                        "searchBase": ""
                    }
                }
            },
            "counter": 0,
            "async": {}
        }
    </script>
TriPSs commented 7 years ago

@bodyno, @kuatro That is correct, i solved this issue in a server package of myself, a example repo on how to use that package is here

This project comes with react-esc, a package i created and actively use myself.

react-esc is a server and client package, so you don't need to create a client or server for your project.