Redux isn't working with server rendering
Tried to render pages with initial state from redux, but no luck. It always renders values from redux store only on client side. Used code from here
Hey @MikeJSX not quite sure I follow? are elements not being sent down? Or are the initial values not correct? Did you modify the example code at all aside from calling createStore with the initial state value? is there an error?
@sresant I didn't, used default code. As I understood store.getState() runs only on the client, I see redux value blinking after I try to reload page and also getting warning
warning.js:36 Warning: React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server: (client) !-- /react-text --><!-- react-text: 4 -- (server) !-- /react-text --></div></div>
Also I noticed next error in server logs Warning: Failed prop type: The prop valueis marked as required inCounter, but its value is null. in Counter (created by Connect(Counter)) in Connect(Counter) in RootElement in Provider (created by RootProvider) in div (created by RootProvider) in RootProvider in RootElement But default value in redux is 0
@MikeJSX weird, i can start up the example and even use an initial value of say value = 1 and it works fine? are you doing something else in the code or starting up react server with different settings?