[英]How react render when both child components are same and parent component differs on condition
I am wondering about How react will render the component when on of the child component are same across different parent?我想知道当子组件在不同父组件上相同时,反应将如何呈现组件?
Lets says让我们说
render(){
someFlag ? <div><MyComponent {...someprops} /></div> : <span><MyComponent {...someprops} /></span>
}
What i think is react many take a reference of MyComponent and serve the same reference with different props as it would be more efficient rather that creating new instance of the component, please guide me how react will render those changes should it create new instance as the parent component is different or my thinking is correct?, still i am relatively new to react我认为反应很多人引用 MyComponent 并使用不同的道具提供相同的引用,因为它会更有效而不是创建组件的新实例,请指导我如果反应创建新实例作为父组件不同或我的想法是正确的?,我还是比较新的反应
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.