35. SERVER SIDE REACT
// server.js
var state = {todos: ["Get in a fistfight", "Buy chain wallet"]}
var markup = React.renderToString(<MyComponent/>);
res.render('index',{
markup: markup,
state: state
});
36. SERVER SIDE REACT
// index.handlebars
<html>
<head></head>
<body>
{{{ markup }}}
<script id="app-state" type="application/json">{{{state}}}</script>
</body>
</html>
37. SERVER SIDE REACT
// client.js
var state = JSON.parse(document.getElementById('app-state').innerHTML);
React.render(<MyComponent state={state}/>, document.body);
40. FLUX ARCHITECTURE
▸ Global Pub/Sub System
▸ Actions send data and action type to Dispatcher
▸ Dispatcher sends actions to Stores & enforces dependencies
▸ Stores receive data, update their data and notify Views
▸ Views update & call actions