/purescript-isomorphic-react-example

Example of Isomorphic React Application written in PureScript

Primary LanguagePureScriptMIT LicenseMIT

Example of Isomorphic React Application written in PureScript

It's using cofree-react-router for routing, the server is written using the hyper library.

In the frontend app the top most component rendered as:

createElement browserRouterClass {router, notFound: Nothing} []

where browserRouterClass comes from cofree-react-router, on the backend we can render the app using:

runRouter url router

since this is how browserRouterClass renders (with exception of routes that where not found). This is fine for react since it compares the html content (using a modified version of adler32, if you wish to check the react code it is here ).

State

The state is manged by purescript-redox which is similar to redux, but the dsl - interpreter pair is a free monad paired with cofree comonad rather than redux actions with redux reducer.