For this website / web application, you can use the reaction on the client side, on the server side, or both.
Client
This is where you fully launch ReactJS in the browser. This is the easiest setup and includes most of the examples (including at http://reactjs.org ). The HTML source code displayed by the server is a placeholder, and the entire user interface is displayed in the browser after loading all of your scripts.
Server
Think of ReactJS as a server template engine (e.g. jade, rudder, etc.). The HTML displayed by the server contains a user interface, as it should be, and you do not expect scripts to load. Your page can be indexed by a search engine (if no javascript is running).
Since the user interface is displayed on the server, none of your event handlers will work, and there is no interactivity (you have a static page).
Both
Here the initial render is on the server. Consequently, the HTML received by the browser has a user interface, as it should be. After loading the scripts, the virtual DOM is re-rendered to configure the event handlers of your components.
Here you need to make sure that you re-render the same virtual DOM (root component of ReactJS) with the same props that you used to render on the server. Otherwise, ReactJS will complain that the virtual DOMs on the server side and on the client side do not match.
Because ReactJS distinguishes between virtual DOMs between re-renderings, the real DOM does not mutate. Only event handlers are associated with real DOM elements.
Gautham Badhrinathan Dec 04 '14 at 10:07 2014-12-04 10:07
source share