Last active
January 7, 2019 10:14
-
-
Save fhammerschmidt/26321175fd77528313155278f278b816 to your computer and use it in GitHub Desktop.
ReasonReact vscode snippets (Preferences > User snippets > reason.json)
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
{ | |
"ReasonReact.statelessComponent": { | |
"prefix": "rrstat", | |
"body": "let component = ReasonReact.statelessComponent(__MODULE__);\n\nlet make = (_children) => {\n\t...component,\n\trender: _self =>\n\t\t<div></div>,\n};", | |
"description": "Create a ReasonReact stateless component" | |
}, | |
"ReasonReact.reducerComponent": { | |
"prefix": "rrred", | |
"body": "type action = | Action1(option(string));\n\ntype state = { state1: option(string) };\n\nlet component = ReasonReact.reducerComponent(__MODULE__);\n\nlet make = children => {\n\t...component,\n\tinitialState: () => { state1: None },\n\treducer: (action, state) =>\n\t\tswitch (action) {\n\t\t| Action1(string1) => ReasonReact.Update({ state1 })\n\t\t},\n\trender: self => <div>{self.state.state1->Belt.Option.getWithDefault(\"\")->ReasonReact.string}</div>,\n};", | |
"description": "Create a ReasonReact reducer component" | |
}, | |
"Reason.mochaTest": { | |
"prefix": "retest", | |
"body": [ | |
"test(\"EnterTestName\", _ => {", | |
" let data = \"data\";", | |
" expect(something(data)) |> toMatchSnapshot;", | |
"});" | |
], | |
"description": "Reason Mocha Test" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment