Skip to content

Commit 82b27aa

Browse files
committed
incorporate improvement suggestions
1 parent f72b049 commit 82b27aa

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ $ mvn spring-boot:run
116116
2018-04-11 09:35:49.853 INFO 88567 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 15 ms
117117
```
118118

119-
Then, in another window, fetch `http://localhost:8080/api/hello` with curl:
119+
Then, in another window, fetch http://localhost:8080/api/hello with curl or your web browser:
120120

121121
```
122122
$ curl http://localhost:8080/api/hello
@@ -126,6 +126,10 @@ Hello, the time at the server is now Wed Apr 11 09:38:19 CEST 2018
126126
That's great, we now have a rest service in Spring Boot up and running!
127127

128128
## Adding React
129+
130+
This section uses the tool [npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b),
131+
which is included with newer versions of `npm`.
132+
129133
```
130134
npx create-react-app frontend
131135

frontend/src/App.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,20 @@ import './App.css';
44

55
class App extends Component {
66

7-
getHello = () => {
7+
state = {};
8+
9+
componentDidMount() {
10+
setInterval(this.hello, 250);
11+
}
12+
13+
hello = () => {
814
fetch('/api/hello')
915
.then(response => response.text())
1016
.then(message => {
1117
this.setState({message: message});
1218
});
1319
};
1420

15-
constructor() {
16-
super();
17-
this.state = {};
18-
}
19-
20-
componentDidMount() {
21-
setInterval(this.getHello, 250);
22-
}
23-
2421
render() {
2522
return (
2623
<div className="App">

0 commit comments

Comments
 (0)