resir014 / react-redux-typescript-example

Demonstrating the common patterns when using React, Redux v4, and TypeScript.
https://resir014.xyz/posts/2018/07/06/redux-4-plus-typescript/
586 stars 149 forks source link

Question about window.INITIAL_REDUX_STATE #18

Closed Ralms closed 4 years ago

Ralms commented 4 years ago

Hi there,

Thank you for this great sample, is helping me a great deal to have a good first implementation of Redux on my React app since I never used Redux previously.

I'm running into an issue, on your root file index.tsx you are getting the initialState with window.INITIAL_REDUX_STATE. On my app gives an error, has no idea what it is and just says the property doesn't exist.

I've done some quick search and this seem to be something for server side rendering? My problem is that my app is a SPA that only runs client side, I don't have any server side, I simply provide the website from a CDN that feeds from a storage account on Azure pretty much.

What would it be the best way for me to get the store initialState to provide to the configureStore() method?

Thank you very much, Ralms.

resir014 commented 4 years ago

Yes, you're right. window.INITIAL_REDUX_STATE is provided by me in the starter as a starting point for people wanting to use this in a SSR-enabled app. You can simply remove the initial state on configureStore() if you don't need it.