Skip to content

Commit

Permalink
把组件写入单独的文件中
Browse files Browse the repository at this point in the history
  • Loading branch information
no1harm committed Oct 25, 2018
1 parent 26519f1 commit 499736a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/components/Welcome.js
@@ -0,0 +1,8 @@
import React, { Component } from 'react';

class Welcome extends Component{
render(){
return <h1>Hello, Component</h1>;
}
}
export default Welcome
7 changes: 4 additions & 3 deletions src/index.js
Expand Up @@ -2,12 +2,13 @@ import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import Welcome from './components/Welcome'
import * as serviceWorker from './serviceWorker';

ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('root')
);
<Welcome/>,
document.getElementById('root')
)

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
Expand Down

0 comments on commit 499736a

Please sign in to comment.