Dva知识集合

1.变量申明

const one = 1
let count = 0

2.模板字符串

const user = 'world'
console.log(hello ${user}) //hello world

3.箭头函数

4.对象字面量

app.model({ reducers:{

add(){
} // <=> add: function() {}
},
}) // 定义对象的方法时,可省略去function

5.扩充组件的props

const attrs = {
href : 'http://exm.org',
target:'_blank'
}
<a {...attrs}>hello

6.propTypes

function App (props){
return

{props.name}

}
App.propTypes = {
name:React.PropTypes.string.isRequired
}

7.Css Modules

.title {
color: red;
}
:global(.title) {
color: green;
}
//然后在引用的时候:
// red
// green

posted @ 2019-05-17 11:05  IT攻略  阅读(337)  评论(0编辑  收藏  举报