const TreeItem = React.memo((props) => { const {component, node, className} = props return ( React.cloneElement(component, {...component.props, node, className}) ) }, (prev, next) => { function isCheckedEqual () { const types = prev.component.props.types, prevNode = prev.node, nextNode = next.node const result = types.every(item => { return prevNode[item.type].check === nextNode[item.type].check || prevNode[item.type].isNearChecked === nextNode[item.type].isNearChecked }) return result } return isCheckedEqual() || prev.node.isCollapse === next.node.isCollapse })
Обсуждают сегодня