A simple React server-side rendering library for Haskell.
NOTICE Currently this server-side renderer assumes the React application uses Redux and handles store initialization and updates.
Render a component using the renderComponent function:
renderComponent
(defaultSettings "path/to/components")
False
"component/Path.js"
(mkReactProps (A.object ["prop" A..= True]))Rendering a component w/ caching enabled only involved setting up the cache first:
cc <- newComponentCache
1 -- number of stripes
2 -- number of cached components per stripe
renderComponent
(defaultSettings "path/to/components")
False
"component/Path.js"
(mkReactProps (A.object []))Components are cached based on a serialization of a JSON object
containing the component path, the component properties, and the special
toStaticMarkup option. For example,
cache_key = SHA1({path: $component_path, props: $component_props, toStaticMarkup: true})
Ensure you have node & npm installed.
Use the Makefile to bootstrap the react & react-dom node js
libraries for testing.
make react react-dom
This is effectively the same as:
cd test/data && npm install react-react-dom