首页 > IT职业 > IT图书 > react.js学习笔记,基础
组件首字母大小写 react 中的组件大写,dom组件小写
组件可以嵌套
大括号里不可以用语句,得用求值表达式,可以用+ - * ..函数也可以使用
驼峰命名
htmlFor 和 className 是jsx中用的,用来代替class和html(保留字无法使用)
在内容里添加注释用{}
在节点里直接添加注释
class App extends Component {
getName() {
if(this.props.name){
return this.props.name
}else {
return "hehehda";
}
}
render() {
return (

Welcome to React {this.getName()} 123s45{
/**
* dswew
*/
}
To get ssstarted, edit 22src/App.js and save to reload.
12
);
}
}
export default App; 来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4606/viewspace-2798308/ ,如需转载,请注明出处,否则将追究法律责任。