Skip to content

Commit bc6f4e1

Browse files
committed
Tweak conventions and fix example
1 parent e563b20 commit bc6f4e1

File tree

4 files changed

+22
-18
lines changed

4 files changed

+22
-18
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"url": "https://github.com/facebookincubator/create-react-app/issues"
99
},
1010
"scripts": {
11-
"start": "node scripts/start.js",
12-
"build": "node scripts/build.js",
11+
"start": "node scripts/start.js --debug-template",
12+
"build": "node scripts/build.js --debug-template",
1313
"create-react-app": "node global-cli/index.js --scripts-version \"$PWD/`npm pack`\""
1414
},
1515
"files": [

template/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<title>React App</title>
77
</head>
88
<body>
9+
<div id="root"></div>
910
<!--
1011
This HTML file is a template.
1112
If you open it directly in the browser, you will see an empty page.

template/src/App.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
1-
import './App.css';
2-
import React from 'react';
1+
import React, { Component } from 'react';
32
import logo from './logo.svg';
3+
import './App.css';
44

5-
export default function App() {
6-
return (
7-
<div className="App">
8-
<div className="App-header">
9-
<img src={logo} className="App-logo" alt="logo" />
10-
<h2>Welcome to React</h2>
5+
class App extends Component {
6+
render() {
7+
return (
8+
<div className="App">
9+
<div className="App-header">
10+
<img src={logo} className="App-logo" alt="logo" />
11+
<h2>Welcome to React</h2>
12+
</div>
13+
<p className="App-intro">
14+
To get started, edit <code>src/App.js</code> and save to reload.
15+
</p>
1116
</div>
12-
<p className="App-intro">
13-
To get started, edit <code>src/App.js</code> and save to reload.
14-
</p>
15-
</div>
16-
);
17+
);
18+
}
1719
}
20+
21+
export default App;

template/src/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import './index.css';
21
import React from 'react';
32
import { render } from 'react-dom';
43
import App from './App';
4+
import './index.css';
55

6-
const rootEl = document.createElement('div');
7-
document.body.appendChild(rootEl);
6+
const rootEl = document.getElementById('root');
87
render(<App />, rootEl);

0 commit comments

Comments
 (0)