Coder Social home page Coder Social logo

mackentoch / react-redux-immutable-webpack-ssr-starter Goto Github PK

View Code? Open in Web Editor NEW
21.0 5.0 8.0 3.53 MB

React + React-Router 4 + Redux + ImmutableJS + Bootstrap + webpack 3 with with Server side rendering, Hot Reload and redux-devtools STARTER

JavaScript 98.80% HTML 0.20% CSS 1.01%
reactjs redux immutablejs immutable webpack react-hot-loader-3 redux-devtools bootstrap chai mocha react-bootstrap ssr starter starter-template starter-project boilerplate webpack3 react-hot-loader3

react-redux-immutable-webpack-ssr-starter's Introduction

React + React-Router + Redux + ImmutableJS + Bootstrap with with Server side rendering, Hot Reload and redux-devtools-extension STARTER

Sponsor

My React + Redux + Immutable + React-Router + Bootstrap + webpack project starter with server side rendering.

  • webpack is as simple as possible
  • ReactJS + Redux + React Router all immutable (all components extend PureComponent).
  • pure front-end = server independant (use whatever you want as server: NodeJS, Rails, .NET...)
  • server side redering

preview

Detailed Content

Front:

Tool chain:

  • babel 6+
  • eslint
  • webpack 3.x
  • hot reload
  • loaders
    • js / jsx
    • sass
    • css
    • json
    • images formats
    • svg and fonts formats
  • postcss

tests:

  • Mocha
  • Chai (+ dirty-chai)
  • enzyme
  • Sinon
  • nyc

Usage

This starter is build with NodeJS 8.1.4 (as stated in engines section of package.json)

Ensure you have a matching node version (nvm is your friend. If you need help to install and use nvm check my gist ๐Ÿ‘)

Install

npm install

bundle dev mode (+ redux-devtools)

npm run dev

dev : hot reload mode (+ redux-devtools)

npm run start

tests

npm run test

bundle production mode

npm run prod

mini node-express server for SPA

with server hot reload (nodemon) and dev bundle:

npm run serve-spa-dev

without hot reload and prod bundle:

npm run serve-spa-prod

SSR server (prod bundle)

npm run serve-ssr

License

The MIT License (MIT)

Copyright (c) 2017 Erwan DATIN

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

react-redux-immutable-webpack-ssr-starter's People

Contributors

mackentoch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

react-redux-immutable-webpack-ssr-starter's Issues

Seems like state is not immutable

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.

React SSR, not showing PreloadedState..

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 :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.