Created
July 22, 2016 01:02
-
-
Save TheSpyder/c3177a9b5b1ad304acc9a2517541fbd4 to your computer and use it in GitHub Desktop.
ocaml reactjs
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
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