Isomorphic Web Apps: MVC is contained both in client-side and server-side. Same rendering engines and same JavaScript logic can be used in server-side (by Mehmetcan Gayberi).
This is the best practice of the React-Redux-Boilerplate, which is a simple project to show how the mechanism of isomorphic application, below is some conception which is new and important for me:
Building static JS file, which is loaded by browsers.
Users request a page, it renders the required component(s) into an HTML string, and then sends it as a response to the client (by Redux).
Provide the data and behavior to presentational or other container components.
const mapStateToProps = (state, ownProps) => {return ...}
const mapDispatchToProps = (dispatch, ownProps) => {return {...}}
const myContainer = connect(mapStateToProps,mapDispatchToProps)(TopicList)
export default myContainer
Have no dependencies on the rest of the app. 2) Are concerned with how things look.
class myComponent extends React.Component {render() {...}}
myComponent.propTypes = {...}
export default myComponent
Actions describe the fact that something happened, but don’t specify how the application’s state changes in response. This is the job of reducers.
It is information that send data from your application to your store store.dispatch()
.
It is a factory function that creates an action. 2) Calling an action creator only produces an action, but does not dispatch it. You need to call the store’s [dispatch](http://redux.js.org/docs/api/Store.html#dispatch)
function to actually cause the mutation.ActionCreator = (...args: any) => Action
It is a higher-order function that composes a dispatch function to return a new dispatch function .
middleware => (dispatch, getState)
$ git clone https://github.com/wahengchang/react-redux-boilerplate-example$ npm install$ npm run test$ npm run dev
https://medium.com/airbnb-engineering/isomorphic-javascript-the-future-of-web-apps-10882b7a2ebc
https://medium.com/monitisemea/isomorphic-universal-javascript-496dc8c4341a