Skip to content

MarcelCutts/ComposableStateRE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ReasonML Composable Component State

This project explores different way of composing state onto components within ReasonML.

Approaches

  1. Reducer component focused on a counter
  2. withState Higher-Order-Component (HOC) bound to Recompose's withState
  3. withState HOC in generic pure ReasonML
  4. Render prop generic component in pure ReasonML

See the result here.

Run Project

yarn
yarn start
# in another tab
yarn webpack

After you see the webpack compilation succeed (the npm run webpack step), open up src/index.html (no server needed!). Then modify whichever .re file in src and refresh the page to see the changes.

For more elaborate ReasonReact examples, please see https://github.com/reasonml-community/reason-react-example

Build for Production

yarn build
yarn webpack:production

This will replace the development artifact build/Index.js for an optimized version.

To enable dead code elimination, change bsconfig.json's package-specs module from "commonjs" to "es6". Then re-run the above 2 commands. This will allow Webpack to remove unused code.

About

Exploration of composable state onto React components in ReasonML

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published