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
var ApplicationStyles = StyleSheet.create` | |
.normalStyle { | |
background-color: white; | |
font-size: 10pt; | |
padding: 1em; | |
margin: 10px; | |
} | |
.childStyle { |
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 ReactDOM | |
module MyComponent = struct | |
(* Component Properties *) | |
type props = {count: int} | |
(* Hey, state can be any type! *) | |
type state = string | |
(* Initializer *) |
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 context = createGlobalContext null in | |
let script = createStringWithUTF8CString "(function(){return 'Hi OCaml, this is your friend JavaScriptCore.';})();" in | |
let valueref = evaluateScript context script null null 0 null in | |
let result = valueToString context valueref null in | |
let ocaml_str = toOCamlString result in ( | |
print_string ocaml_str; | |
releaseString script; | |
releaseGlobalContext context; | |
releaseOCamlString ocaml_str);; |
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
const test = (props) => ( | |
<div> | |
{match(props).with( | |
(String) => <div>Should work {props}</div>, | |
({bar = '1', test: {x = false}}) => <div>Super cool {bar}</div>, | |
({bar = '5', test: {y = true}}) => <div>Mega cool {test.y} {y}</div>, | |
([a = 3, {x = 4}, z]) => | |
<nesting> | |
{match(z).with( | |
({bar = '5', test: {y = true}}) => |
OlderNewer