What it does
- the server passes JSON to React. This server contains the entire state of the page.
- React has the HTML templates to render that JSON with
- the entire website only makes AJAX requests for data, only the very first request gets a full webpage back
- React keeps polling the server for the current JSON state (TODO can it handle only diffs as well?)
- given a new state, React re-renders the entire page. But it does so smartly, skipping items whose state hasn’t changed.
- only the modified
bodycontent needs to be reloaded via AJAX.
- don’t need to pass rendered templates to AJAX or re-write templates in for AJAX. Every template is AJAX. Server only sends JSON.
- https://github.com/reactjs/react-tutorial official, servers in multiple languages. Too basic, not very interesting. Restrictive copyright by Facebook.
Notable for me:
- Reddit mobile: https://www.reddit.com/r/reactjs/comments/456aw0/how_is_reddit_using_reactjs/
var myDivElement = <div className="foo" />;
Insanity, why not just pass strings literals to some library?
The React tutorial uses it: https://github.com/reactjs/react-tutorial/blob/4fa16fde3795ff7047322f28320cffc3b2b385ec/public/scripts/example.js#L77