We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
const defaultArray = []; <TestComponent values={this.props.values || defaultArray }/>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
当父级节点更细的时候,子节点也会对应更新渲染,即使此时的state不需要进行render
pureComponent 帮我们对state props 做一层浅比较。减少不必要的render操作
<TestComponent values={this.props.values || []}/> 如果此时this.props.values 是不存在的话
则每次都会重新生成一个空数组
<TestComponent onChange = { this.handleChange.bind(this)} />
每一次onchange的时候都会生成一个新的函数
引用不一致 导致父组件render 同时导致子组件也进行render
提前绑定 直接传递
@autoBind
handleChange(){}
<TestComponent onChange = { this.handleChange} />
The text was updated successfully, but these errors were encountered: