Skip to content

Instantly share code, notes, and snippets.

@rlucha
Created May 10, 2017 12:21
Show Gist options
  • Select an option

  • Save rlucha/b84a77a6cecf37bb608617413c85c5c9 to your computer and use it in GitHub Desktop.

Select an option

Save rlucha/b84a77a6cecf37bb608617413c85c5c9 to your computer and use it in GitHub Desktop.
/* from https://github.com/reasonml/reason-react/blob/master/src/reactDOMRe.re */
/* First time reading an OCaml/Reason/BuckleScript file? */
/* `external` is the foreign function call in OCaml. */
/* here we're saying `I guarantee that on the JS side, we have a `render` function in the module "react-dom"
that takes in a reactElement, a dom element, and returns unit (nothing) */
/* It's like `let`, except you're pointing the implementation to the JS side. The compiler will inline these
calls and add the appropriate `require("react-dom")` in the file calling this `render` */
external render : ReactRe.reactElement => Dom.element => unit =
"render" [@@bs.val] [@@bs.module "react-dom"];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment