Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions jscomp/bsb/templates/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ npm start
# in another tab
npm run webpack
```

After you see the webpack compilation succeed (the `npm run webpack` step), open up `src/index.html` (**no server needed!**). Then modify whichever `.re` file in `src` and refresh the page to see the changes.

**For more elaborate ReasonReact examples**, please see https://github.com/reasonml-community/reason-react-example
Expand Down
5 changes: 1 addition & 4 deletions jscomp/bsb/templates/react/bsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,5 @@
"bs-dependencies": [
"reason-react"
],
"refmt": 3,
"warnings": {
"error": "+5"
}
"refmt": 3
}
2 changes: 1 addition & 1 deletion jscomp/bsb/templates/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dependencies": {
"react": "^16.2.0",
"react-dom": "^16.2.0",
"reason-react": ">=0.3.4"
"reason-react": ">=0.4.0"
},
"devDependencies": {
"bs-platform": "^${bsb:bs-version}",
Expand Down
2 changes: 1 addition & 1 deletion jscomp/bsb/templates/react/src/Component1.re
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ let make = (~message, _children) => {
...component,
render: self =>
<div onClick=(self.handle(handleClick))>
(ReasonReact.stringToElement(message))
(ReasonReact.string(message))
</div>,
};
9 changes: 3 additions & 6 deletions jscomp/bsb/templates/react/src/Component2.re
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,12 @@ let make = (~greeting, _children) => {
"You've clicked this " ++ string_of_int(self.state.count) ++ " times(s)";
<div>
<button onClick=(_event => self.send(Click))>
(ReasonReact.stringToElement(message))
(ReasonReact.string(message))
</button>
<button onClick=(_event => self.send(Toggle))>
(ReasonReact.stringToElement("Toggle greeting"))
(ReasonReact.string("Toggle greeting"))
</button>
(
self.state.show ?
ReasonReact.stringToElement(greeting) : ReasonReact.nullElement
)
(self.state.show ? ReasonReact.string(greeting) : ReasonReact.null)
</div>;
},
};