3 ms·
React can run both on client and server as well! Would like to see it in the list.
by arianvanp 12y ago
React can run both on client and server as well! Would like to see it in the list.
- pluma 12y agoTo be fair, it works on the server by simply not executing the parts that are meant to be executed after the components have been rendered (which is why you're supposed to do AJAX requests, event listeners and other things in `componentDidMount`). Not saying that doesn't work, in fact it works very well. It just means your server-side React code can't be async.
- pluma 12y agoAfter watching more about Flux and React: I may have been wrong. Flux seems to get away with React components being entirely synchronous by offloading all the async parts into the interaction between dispatchers, actions and stores. As the only thing React forces you to keep synchronous is the component code leading up to the rendering, I guess you could just wait for the stores to be ready and loaded before rendering the components. The more you know.