Skip to content

Instantly share code, notes, and snippets.

@rafayepes
Created May 10, 2017 20:20
Show Gist options
  • Save rafayepes/afc0e26f5fcea51b6585019204117dab to your computer and use it in GitHub Desktop.
Save rafayepes/afc0e26f5fcea51b6585019204117dab to your computer and use it in GitHub Desktop.
Reason JSX example
module App = {
include ReactRe.Component;
let name = "App";
type props = {
dispatch: Store.action => unit,
state: Store.state,
};
let className: string =
Styles.make
alignItems::"center"
display::"flex"
flexDirection::"column"
()
|> Styles.className;
let render { props: { dispatch, state: { operations } } } => {
let output = Operation.getInput operations;
<main className>
<Hero />
<Calculator>
<Display output />
<Buttons dispatch />
</Calculator>
</main>;
};
};
include ReactRe.CreateComponent App;
let createElement ::state ::dispatch => wrapProps { dispatch, state };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment