Skip to content

Instantly share code, notes, and snippets.

@TheSpyder
Created July 22, 2016 01:02
Show Gist options
  • Save TheSpyder/c3177a9b5b1ad304acc9a2517541fbd4 to your computer and use it in GitHub Desktop.
Save TheSpyder/c3177a9b5b1ad304acc9a2517541fbd4 to your computer and use it in GitHub Desktop.
ocaml reactjs
let () =
console_log "ocaml is alive!";
module MyComponent = struct
type props = {
name: string;
color: string
}
let render props = ReactDOM.p ("Hello, " ^ props.color ^ " " ^ props.name)
end
module MyComponentClass = React.CreateClass (MyComponent)
let props = MyComponent.({ name = "World"; color = "Blue" }) in
React.render (MyComponentClass.create props) (get_element_by_id "container")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment