[英]React: How can I prevent the parent component re-rendering onmousemove state change when only the child component needs re-rendering?
父组件更新状态 onmousemove 中的 x,y 属性,然后这些属性通过 props 传递给子组件。 目前,父节点和子节点都重新渲染 onmousemove; 有没有办法防止在父级上重新渲染,以便只有子级重新渲染? 示例:父级为边界区域,子级为自定义光标。
保持子组件本地的 state(x,y coords)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.