Skip to content

Instantly share code, notes, and snippets.

@desmond-dsouza
Created February 10, 2018 20:15
Show Gist options
  • Save desmond-dsouza/1c8c9afb791ee24bacd095b120e70d28 to your computer and use it in GitHub Desktop.
Save desmond-dsouza/1c8c9afb791ee24bacd095b120e70d28 to your computer and use it in GitHub Desktop.
Partial application of ReasonReact JSX component
open BsReactNative;
open ReasonReact;
module RenderTable = {
let component = ReasonReact.statelessComponent("RenderTable");
let make = (~rowHeight, ~patients, children) => {
...component,
render: _self =>
<View>
<Text value=patients />
<Text value=(string_of_int(rowHeight)) />
<View> ...children </View>
</View>
};
};
let renderTable = (~rowHeight, ~patients, children: Js.Array.t(reactElement)) =>
<RenderTable rowHeight patients> ...children </RenderTable>;
let partialTable = renderTable(~rowHeight=20, ~patients="Sam, Sue");
let sw = aBool =>
aBool ?
partialTable([|<Text value="True" />|]) :
partialTable([|<Text value="False" />|]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment