摘要: constructor(props){ super(props) this.myRefs = React.createRef(); } refFun(){ const node = this.myRefs.current node.style.color = "red" } render() { r 阅读全文
posted @ 2020-07-03 17:26 chenlw101 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 注 : React.PropTypes 在 React v15.5 版本后已经移到了 prop-types 库。 import PropTypes from 'prop-types' render(){ return ( <div> <div>111</div> //子组件可以{...this.pr 阅读全文
posted @ 2020-07-03 16:23 chenlw101 阅读(376) 评论(0) 推荐(0) 编辑
摘要: //子组件(传参数) < input type = "button" value = "提交" onClick = { ()=>{ this.props.handleChange('123') } } / > //子组件(传输入值) < input onChange = { this.props.h 阅读全文
posted @ 2020-07-03 15:48 chenlw101 阅读(342) 评论(0) 推荐(0) 编辑