Created
February 10, 2018 20:15
-
-
Save desmond-dsouza/1c8c9afb791ee24bacd095b120e70d28 to your computer and use it in GitHub Desktop.
Partial application of ReasonReact JSX component
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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