Tweak conventions and fix example

This commit is contained in:
Dan Abramov
2016-07-21 05:55:22 +01:00
parent e563b209c7
commit bc6f4e199c
4 changed files with 22 additions and 18 deletions

View File

@@ -8,8 +8,8 @@
"url": "https://github.com/facebookincubator/create-react-app/issues" "url": "https://github.com/facebookincubator/create-react-app/issues"
}, },
"scripts": { "scripts": {
"start": "node scripts/start.js", "start": "node scripts/start.js --debug-template",
"build": "node scripts/build.js", "build": "node scripts/build.js --debug-template",
"create-react-app": "node global-cli/index.js --scripts-version \"$PWD/`npm pack`\"" "create-react-app": "node global-cli/index.js --scripts-version \"$PWD/`npm pack`\""
}, },
"files": [ "files": [

View File

@@ -6,6 +6,7 @@
<title>React App</title> <title>React App</title>
</head> </head>
<body> <body>
<div id="root"></div>
<!-- <!--
This HTML file is a template. This HTML file is a template.
If you open it directly in the browser, you will see an empty page. If you open it directly in the browser, you will see an empty page.

View File

@@ -1,17 +1,21 @@
import './App.css'; import React, { Component } from 'react';
import React from 'react';
import logo from './logo.svg'; import logo from './logo.svg';
import './App.css';
export default function App() { class App extends Component {
return ( render() {
<div className="App"> return (
<div className="App-header"> <div className="App">
<img src={logo} className="App-logo" alt="logo" /> <div className="App-header">
<h2>Welcome to React</h2> <img src={logo} className="App-logo" alt="logo" />
<h2>Welcome to React</h2>
</div>
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>
</div> </div>
<p className="App-intro"> );
To get started, edit <code>src/App.js</code> and save to reload. }
</p>
</div>
);
} }
export default App;

View File

@@ -1,8 +1,7 @@
import './index.css';
import React from 'react'; import React from 'react';
import { render } from 'react-dom'; import { render } from 'react-dom';
import App from './App'; import App from './App';
import './index.css';
const rootEl = document.createElement('div'); const rootEl = document.getElementById('root');
document.body.appendChild(rootEl);
render(<App />, rootEl); render(<App />, rootEl);