Skip to content

Commit 08bcc39

Browse files
committed
Refactor HelloWorld component
1 parent 0f981c4 commit 08bcc39

File tree

2 files changed

+17
-29
lines changed

2 files changed

+17
-29
lines changed

app/javascript/bundles/HelloWorld/HelloWorld.re

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@react.component
2+
let make = (~nameProp: string) => {
3+
let (name, setName) = React.useState(() => nameProp)
4+
5+
<div>
6+
<h3> {("Hello, " ++ name ++ "!") -> React.string} </h3>
7+
<form>
8+
<label htmlFor="name"> {"Say hello to:" -> React.string} </label>
9+
<input
10+
id="name"
11+
type_="text"
12+
value=name
13+
onChange={event => setName(event -> Utils.eventTargetValue)}
14+
/>
15+
</form>
16+
</div>
17+
}

0 commit comments

Comments
 (0)