Skip to content

Commit 00851f0

Browse files
authored
Merge pull request #3136 from jdeisenberg/master
Fix typo in React and React-lite templates
2 parents 2bf677f + 66b1325 commit 00851f0

File tree

7 files changed

+22
-21
lines changed

7 files changed

+22
-21
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is the basic component. */
2-
let component = ReasonReact.statelessComponent("Page");
2+
let component = ReasonReact.statelessComponent("Component1");
33

44
/* Your familiar handleClick from ReactJS. This mandatorily takes the payload,
55
then the `self` record, which contains state (none here), `handle`, `reduce`
@@ -9,15 +9,15 @@ let handleClick = (_event, _self) => Js.log("clicked!");
99
/* `make` is the function that mandatorily takes `children` (if you want to use
1010
`JSX). `message` is a named argument, which simulates ReactJS props. Usage:
1111
12-
`<Page message="hello" />`
12+
`<Component1 message="hello" />`
1313
1414
Which desugars to
1515
16-
`ReasonReact.element(Page.make(~message="hello", [||]))` */
16+
`ReasonReact.element(Component1.make(~message="hello", [||]))` */
1717
let make = (~message, _children) => {
1818
...component,
1919
render: self =>
2020
<div onClick=(self.handle(handleClick))>
21-
(ReasonReact.string(message))
21+
{ReasonReact.string(message)}
2222
</div>,
2323
};

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ let make = (~greeting, _children) => {
3232
let message =
3333
"You've clicked this " ++ string_of_int(self.state.count) ++ " times(s)";
3434
<div>
35-
<button onClick=(_event => self.send(Click))>
36-
(ReasonReact.string(message))
35+
<button onClick={_event => self.send(Click)}>
36+
{ReasonReact.string(message)}
3737
</button>
38-
<button onClick=(_event => self.send(Toggle))>
39-
(ReasonReact.string("Toggle greeting"))
38+
<button onClick={_event => self.send(Toggle)}>
39+
{ReasonReact.string("Toggle greeting")}
4040
</button>
41-
(self.state.show ? ReasonReact.string(greeting) : ReasonReact.null)
41+
{self.state.show ? ReasonReact.string(greeting) : ReasonReact.null}
4242
</div>;
4343
},
4444
};
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
ReactDOMRe.renderToElementWithId(<Component1 message="Hello!" />, "index1");
1+
ReactDOMRe.renderToElementWithId(<Component1 message="Hello! Click this text." />, "index1");
22

33
ReactDOMRe.renderToElementWithId(<Component2 greeting="Hello!" />, "index2");
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is the basic component. */
2-
let component = ReasonReact.statelessComponent("Page");
2+
let component = ReasonReact.statelessComponent("Component1");
33

44
/* Your familiar handleClick from ReactJS. This mandatorily takes the payload,
55
then the `self` record, which contains state (none here), `handle`, `reduce`
@@ -9,15 +9,15 @@ let handleClick = (_event, _self) => Js.log("clicked!");
99
/* `make` is the function that mandatorily takes `children` (if you want to use
1010
`JSX). `message` is a named argument, which simulates ReactJS props. Usage:
1111
12-
`<Page message="hello" />`
12+
`<Component1 message="hello" />`
1313
1414
Which desugars to
1515
16-
`ReasonReact.element(Page.make(~message="hello", [||]))` */
16+
`ReasonReact.element(Component1.make(~message="hello", [||]))` */
1717
let make = (~message, _children) => {
1818
...component,
1919
render: self =>
20-
<div onClick=(self.handle(handleClick))>
21-
(ReasonReact.string(message))
20+
<div onClick={self.handle(handleClick)}>
21+
{ReasonReact.string(message)}
2222
</div>,
2323
};

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ let make = (~greeting, _children) => {
3232
let message =
3333
"You've clicked this " ++ string_of_int(self.state.count) ++ " times(s)";
3434
<div>
35-
<button onClick=(_event => self.send(Click))>
36-
(ReasonReact.string(message))
35+
<button onClick={_event => self.send(Click)}>
36+
{ReasonReact.string(message)}
3737
</button>
38-
<button onClick=(_event => self.send(Toggle))>
39-
(ReasonReact.string("Toggle greeting"))
38+
<button onClick={_event => self.send(Toggle)}>
39+
{ReasonReact.string("Toggle greeting")}
4040
</button>
41-
(self.state.show ? ReasonReact.string(greeting) : ReasonReact.null)
41+
{self.state.show ? ReasonReact.string(greeting) : ReasonReact.null}
4242
</div>;
4343
},
4444
};
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
ReactDOMRe.renderToElementWithId(<Component1 message="Hello!" />, "index1");
1+
ReactDOMRe.renderToElementWithId(<Component1 message="Hello! Click this text." />, "index1");
22

33
ReactDOMRe.renderToElementWithId(<Component2 greeting="Hello!" />, "index2");

jscomp/bsb/templates/react/src/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<body>
88
Component 1:
99
<div id="index1"></div>
10+
1011
Component 2:
1112
<div id="index2"></div>
1213

0 commit comments

Comments
 (0)