React
Create React App

1.npx create-react-app basic

index.js

import React from 'react'
import ReactDOM from 'react-dom'

ReactDOM.render(组件,根节点,ront)

React命名规则:首字母必须大写

视图概念:

App.js:
import React from 'react'
class App extends React.Component{

constructor(porps){
    super(props)
    this.state = {
        xxx:xxx
    }
}

componentDidMount(){
    生命周期钩子
    xxx(){
        this.setState({
            tick:this.state.tick + 1
        })
    }
}

render(){
    return( <div>{this.props.title}</div> )
}

}
在模板中要写js请加上 {}

{ xxx.map(value)=>{return <h1>value<h2>} }

Last modification:July 24th, 2019 at 11:27 pm
如果觉得我的文章对你有用,请随意赞赏