mackentoch / react-redux-immutable-webpack-ssr-starter Goto Github PK
View Code? Open in Web Editor NEWReact + React-Router 4 + Redux + ImmutableJS + Bootstrap + webpack 3 with with Server side rendering, Hot Reload and redux-devtools STARTER
React + React-Router 4 + Redux + ImmutableJS + Bootstrap + webpack 3 with with Server side rendering, Hot Reload and redux-devtools STARTER
Thank you very much for the code, very useful. May be I am not getting it right, but it seems to me like the state is not immutable. look at this:
This is where you create the state to be sent to the client:
const preloadedState = serialize(store.getState().toJS()); // serialize is better than JSON.stringify
And this is where you send it:
<body class="skin-black" style="background-color:#f1f2f7">
<section id="root"><div>${html}</div></section>
<script type="text/javascript">window.__PRELOADED_STATE__ = ${preloadedState}</script>
<script type="text/javascript" src="/assets/app.vendor.bundle.js"></script>
<script type="text/javascript" src="/assets/app.bundle.js"></script>
</body>
The preloaded state it already converted from immutable to js Object using .toJS()
.
I though you would have converted back the state to the original immutable object.
It is easy to do with immutable's .fromJS()
function, but it become complicated when the state contains Records.
I am actually struggling with the module transit-immutable-js to achieve that, but I am facing some troubles, I hoped you got an alternative.
The application running well, but SSR not working correctly.. STATE not showing after fetch data..
<script type="text/javascript">window.__PRELOADED_STATE__ = {"views":{"currentView":"not set","enterTime":null,"leaveTime":null,"somePropFromServer":"whats up?","serverTime":"2020-01-13T15:35:27+07:00"},"userAuth":{"lastname":"","isAuthenticated":false,"login":"","time":"","isFetching":false,"isLogging":false,"token":null,"id":"","firstname":""},"routing":{"locationBeforeTransitions":null}}</script>can you help me for this :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.