答案: ReactDOM.render(A,B);将A渲染到B指定的容器中 注意事项: 不允许一次渲染多个标签,但是可以放在同一个顶层标签 每一个标记都要有对应的结束
(1) 父与子通信 借助于属性 往下传值 传值: son myName=”123”></son. 接受值: this.props.myName (2) 子与父通信 通过属性传递有参数的方法 让子组件调用是传值 ①定义有参数的方法 rcvMsg(msg){} ②传递给子组件 ③子组件来调用 This.props.funcRcv(123)
This.props.children
mount: componentWillMount componentDidMount update: componentWillUpdate componentDidUpdate componentWillReceiveProps unmount: componentWillUnmount
(1) 判断 短路逻辑
{ expression && <Any></Any> }(2) 循环 遍历集合
this.state.list .map((value,index)=>{ return <li key={index}> {value} </li> })ReactNative是实现原生开发的框架 可以使用react的语法和js来编写
开发理念: Learn once,write anywhere
在dom变化时 快速定位元素 提升更新效率
reactjs、 reactNative、 react360 、flux、 redux、 ssr、 reactNavigation…
跳转: this.props.navigation.navigate() 传参: this.props.navigation.navigate(‘detail’,{id:10}) this.props.navigation.getParam(‘id’)
可以使用c3中的flexbox