-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
59c42e9
commit b617e8b
Showing
15 changed files
with
368 additions
and
96 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
singleQuote: true | ||
trailingComma: all | ||
tabWidth: 2 | ||
semi: true |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,13 +17,16 @@ | |
"author": "Aaron Ross <[email protected]>", | ||
"license": "MIT", | ||
"dependencies": { | ||
"bulma": "^0.7.2", | ||
"react": "^16.2.0", | ||
"react-dom": "^16.2.0", | ||
"reason-react": ">=0.4.0" | ||
}, | ||
"devDependencies": { | ||
"bs-platform": "^4.0.7", | ||
"css-loader": "^1.0.1", | ||
"html-webpack-plugin": "^3.2.0", | ||
"style-loader": "^0.23.1", | ||
"webpack": "^4.0.1", | ||
"webpack-cli": "^3.1.1", | ||
"webpack-dev-server": "^3.1.8" | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
[%bs.raw {|require("bulma/css/bulma.css")|}]; | ||
|
||
ReactDOMRe.renderToElementWithId(<App />, "root"); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,6 @@ | ||
let component = ReasonReact.statelessComponent("App"); | ||
|
||
let make = (_children) => { | ||
let make = _children => { | ||
...component, | ||
render: (_self) => ( | ||
<div> | ||
<Greeting name="Aaron" /> | ||
<Stateful greeting="foo" /> | ||
</div> | ||
), | ||
render: _self => <div> <Greeting name="Aaron" /> <Stateful /> </div>, | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
let component = ReasonReact.statelessComponent("Button"); | ||
|
||
let make = (~text, ~onClick, _children) => { | ||
...component, | ||
render: _self => | ||
<button onClick className="button"> (ReasonReact.string(text)) </button>, | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,25 @@ | ||
type state = { | ||
count: int, | ||
show: bool, | ||
}; | ||
type state = {count: int}; | ||
|
||
type action = | ||
| Increment | ||
| Decrement | ||
| Toggle; | ||
| Decrement; | ||
|
||
let component = ReasonReact.reducerComponent("Stateful"); | ||
|
||
let make = (~greeting, _children) => { | ||
let make = _children => { | ||
...component, | ||
initialState: () => {count: 0, show: true}, | ||
initialState: () => {count: 0}, | ||
reducer: (action, state) => | ||
switch (action) { | ||
| Increment => ReasonReact.Update({...state, count: state.count + 1}) | ||
| Decrement => ReasonReact.Update({...state, count: state.count - 1}) | ||
| Toggle => ReasonReact.Update({...state, show: !state.show}) | ||
| Increment => ReasonReact.Update({count: state.count + 1}) | ||
| Decrement => ReasonReact.Update({count: state.count - 1}) | ||
}, | ||
render: self => { | ||
let message = "You've clicked this " ++ string_of_int(self.state.count) ++ " times(s)"; | ||
render: self => | ||
<div> | ||
<button onClick=(_event => self.send(Increment))> | ||
(ReasonReact.string("-")) | ||
</button> | ||
<button onClick=(_event => self.send(Decrement))> | ||
(ReasonReact.string("+")) | ||
</button> | ||
<button onClick=(_event => self.send(Toggle))> | ||
(ReasonReact.string("Toggle greeting")) | ||
</button> | ||
( | ||
self.state.show | ||
? ReasonReact.string(greeting) | ||
: ReasonReact.null | ||
) | ||
</div>; | ||
}, | ||
<Button text="-" onClick=(_event => self.send(Decrement)) /> | ||
<div className="foo"> | ||
(ReasonReact.string(string_of_int(self.state.count) ++ "foo")) | ||
</div> | ||
<Button text="+" onClick=(_event => self.send(Increment)) /> | ||
</div>, | ||
}; |
This file contains 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
This file contains 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
Oops, something went wrong.