Skip to content

Commit 9148b09

Browse files
authored
Merge pull request #2770 from chenglou/rr
[Bsb templates] Update ReasonReact template
2 parents 57a43a6 + a28c681 commit 9148b09

File tree

5 files changed

+7
-12
lines changed

5 files changed

+7
-12
lines changed

jscomp/bsb/templates/react/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ npm start
88
# in another tab
99
npm run webpack
1010
```
11+
1112
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.
1213

1314
**For more elaborate ReasonReact examples**, please see https://github.com/reasonml-community/reason-react-example

jscomp/bsb/templates/react/bsconfig.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,5 @@
2020
"bs-dependencies": [
2121
"reason-react"
2222
],
23-
"refmt": 3,
24-
"warnings": {
25-
"error": "+5"
26-
}
23+
"refmt": 3
2724
}

jscomp/bsb/templates/react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"dependencies": {
1818
"react": "^16.2.0",
1919
"react-dom": "^16.2.0",
20-
"reason-react": ">=0.3.4"
20+
"reason-react": ">=0.4.0"
2121
},
2222
"devDependencies": {
2323
"bs-platform": "^${bsb:bs-version}",

jscomp/bsb/templates/react/src/Component1.re

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ let make = (~message, _children) => {
1818
...component,
1919
render: self =>
2020
<div onClick=(self.handle(handleClick))>
21-
(ReasonReact.stringToElement(message))
21+
(ReasonReact.string(message))
2222
</div>,
2323
};

jscomp/bsb/templates/react/src/Component2.re

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,12 @@ let make = (~greeting, _children) => {
3333
"You've clicked this " ++ string_of_int(self.state.count) ++ " times(s)";
3434
<div>
3535
<button onClick=(_event => self.send(Click))>
36-
(ReasonReact.stringToElement(message))
36+
(ReasonReact.string(message))
3737
</button>
3838
<button onClick=(_event => self.send(Toggle))>
39-
(ReasonReact.stringToElement("Toggle greeting"))
39+
(ReasonReact.string("Toggle greeting"))
4040
</button>
41-
(
42-
self.state.show ?
43-
ReasonReact.stringToElement(greeting) : ReasonReact.nullElement
44-
)
41+
(self.state.show ? ReasonReact.string(greeting) : ReasonReact.null)
4542
</div>;
4643
},
4744
};

0 commit comments

Comments
 (0)