Skip to content
New issue

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

条件渲染对组件无效 #285

Closed
kenberkeley opened this issue Jul 7, 2018 · 5 comments
Closed

条件渲染对组件无效 #285

kenberkeley opened this issue Jul 7, 2018 · 5 comments

Comments

@kenberkeley
Copy link

kenberkeley commented Jul 7, 2018

如下图,父组件的 this.state.msg 初始化为 null 的时候,子组件 Test 显然不应该被渲染,否则必然会发生逻辑错误(例如在子组件 Test 中的 componentWillMount 中发送网络请求,但 this.props.msg 还是 null 就尴尬了)

(版本 0.0.67)

image

@luckyadam
Copy link
Member

确实会有这个问题,在运行时没有加入组件是否显示的判断,导致只要使用了组件就会执行挂载的生命周期,下下个版本 (0.0.69) 修复

@ogundiperukayah
Copy link

Good

@luckyadam
Copy link
Member

目前还是没有修复这个问题~预计原声组件化方案完成后可以解决

@kenberkeley
Copy link
Author

image

@luckyadam
Copy link
Member

最新的 beta 版本已经修复了这个问题~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants