Isomorphic JavaScript is code that can run on both the server and the client. The benefits of this are that the initial page can be rendered server-side to improve page-load times, with the JavaScript also being loaded client-side to enable dynamic updates. The recommended stack is;
- Code should be written in React
- Redux used as a data store to help make data available both server and client side
- Classnames to enable the easy joining of classNames
- Jest for testing
- The static site generator Gatsby to implement
- The first implementation of this was in the prospectus repo.
- As part of the build process static HTML files are generated for each page.
- The Discovery Scale pod are currently tasked with looking into the scaleability of this approach (to enable regeneration of pages based on updates to external data).
- The server generated code assumes logged out users
The
componentDidMount
method is utilized to update the pages with any user specific information.