React in action

1. Component to interface process:

Define a component app.js export -------> index.js get app.js component -------> render into index.html

1. Component: app.js component

 1) The HTML node returned in the return function of the component must be a

 2) The way to define a component is ES6 syntax:

class APP extends React.Component{......}

 You can also use React.creactClass({})

3) Components that can be used externally: use export default to export components

export default class APP extends React.Component{......}

or

class App extends React.Component{
    render(){
        return (<div>This is a component</div>);
    }
}
export default  App;

 

2. Definition of entry : index.js file

ReactDOM.render(<App />.document.getElementById("box"))

 

3. Page : index.html

<div id="box"></div>

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324850164&siteId=291194637