react-memo

How to render only subchild without rendering all high level component

狂风中的少年 提交于 2021-02-11 06:29:56
问题 I m having one sub child component which is inside a loop of parent component. when one of the sub child components is updating the state of parent component, it is re-rendering the all children since it is loop. How can i avoid the re-render for each iteration. It should update that particular sub child. import React, { useState } from "react"; function Parent() { const [selectedChild, setSelectedChild] = useState([]); const onChangeHandle = (event, id) => { const checked = event.target