V
Size: a a a
V
P
export default React.memo(PatientTableRowContainer)
<List
ref={ref}
outerRef={outerRef}
style={{ width: "100%", ...style}}
height={window.innerHeight}
itemCount={patientsIds.length}
onScroll={onScroll}
itemSize={76}
width={"100%"}
>
{({ index, style }: { index: number, style: any }) => (
<PatientTableRowContainer key={patientsIds[index]}
{...{ patientID: patientsIds[index], index, style, canReadOnly, position, updateDatepickerPosition }}
/>
)
}
</List>
TG
TG
export default React.memo(PatientTableRowContainer)
<List
ref={ref}
outerRef={outerRef}
style={{ width: "100%", ...style}}
height={window.innerHeight}
itemCount={patientsIds.length}
onScroll={onScroll}
itemSize={76}
width={"100%"}
>
{({ index, style }: { index: number, style: any }) => (
<PatientTableRowContainer key={patientsIds[index]}
{...{ patientID: patientsIds[index], index, style, canReadOnly, position, updateDatepickerPosition }}
/>
)
}
</List>
TG
TG
export default React.memo(PatientTableRowContainer)
<List
ref={ref}
outerRef={outerRef}
style={{ width: "100%", ...style}}
height={window.innerHeight}
itemCount={patientsIds.length}
onScroll={onScroll}
itemSize={76}
width={"100%"}
>
{({ index, style }: { index: number, style: any }) => (
<PatientTableRowContainer key={patientsIds[index]}
{...{ patientID: patientsIds[index], index, style, canReadOnly, position, updateDatepickerPosition }}
/>
)
}
</List>
TG
P
function customFunction(prevProps:any, nextProps:any) {
if(!R.equals(prevProps, nextProps)){
return true
}
return false
}
export default React.memo(PatientTableRowContainer, customFunction)
V
TG
function customFunction(prevProps:any, nextProps:any) {
if(!R.equals(prevProps, nextProps)){
return true
}
return false
}
export default React.memo(PatientTableRowContainer, customFunction)
const mapProps = {};вот такой код воткни в первую строку функции и законсоль mapProps что бы увидеть кто из пропсов изменяется и мешает мемоизации
Object
.keys(prevProps)
.forEach((key) =>
prevProps[key] !== nextProps[key]
? mapProps[key] = {prev: prevProps[key], next: nextProps[key]}
: null
)
TG
TG
function customFunction(prevProps:any, nextProps:any) {
if(!R.equals(prevProps, nextProps)){
return true
}
return false
}
export default React.memo(PatientTableRowContainer, customFunction)
TG
TG
ErrorBoundary
. И лучше в композиции, где используется ViewSource
сделать обертки (2 фото)V
V
TG
ErrorBoundary
. И лучше в композиции, где используется ViewSource
сделать обертки (2 фото)V
TG
V