GreenInfo-Network / caliparks.org

Mapping social media in parks and other open spaces
http://www.caliparks.org/
22 stars 3 forks source link

Server side rendering? #651

Closed clhenrick closed 4 years ago

clhenrick commented 7 years ago

Relating to #650 was server-side rendering ever considered?

The way React Router is currently being used seems odd, as the routing seems to be handled by Express, not React Router. If the initial app state were rendered server side then React Router could handle the routing, the app would be a SPA, Express would be used solely as an API and not for routing.

On the other hand if the express routes are absolutely necessary then it seems React Router may not be needed?

@sconnelley @mojodna any insights on the current setup with Express and React Router would be appreciated, thanks.

clhenrick commented 7 years ago

Server side rendering was implemented using the "react-engine" library which allows for coordination between routes in both React Router and Express. Noting that this set up doesn't lend the app to a universal / isomorphic app as full page reloads are required when changing routes or language / locales.

Some of the dependencies probably could be upgraded, (e.g. React, React Router, React Engine, React International) which may or may not help with the initial FOUC. If adding new features it may not be a bad idea to upgrade dependencies.