React学习——模板语法与数据使用体验
DogJay
2019-01-31
【前端技术】
521人已围观
import React, { Component } from 'react';
class App extends Component {
constructor(props){
super(props);
this.state = {
str:'这是React的数据',
num:1,
inputValue:"这是value",
arr:['a','b','c']
}
}
render() {//渲染
return (
<div>
<div>{this.state.str}</div>
<div>{this.state.str}</div>
<div>{this.state.num+1}</div>
<input type='text' value={this.state.inputValue}/>
<div>{this.setComponent()}</div>
</div>
);
}
setComponent(){
return this.state.arr.join("|")
}
}
export default App;
吐槽(0)
上一篇:Python集成开发环境