Dear các Anh
em có một đoạn code như này
const FunctionListRender = ({ functionList }) => {
if (functionList) {
return (
<Table.Body>
{functionList.map((func, index) =>
(<FunctionRender
key={`func_${index + 1}`}
func={func}
index={index + 1}
/>))}
</Table.Body>
);
}
return (<Table.Body />);
};
const FunctionRender = ({ func, index }) => (
<Table.Row key={index}>
<Table.Cell textAlign="center" verticalAlign="middle">{index}</Table.Cell>
<Table.Cell textAlign="left" verticalAlign="middle">{func.functionParentName ? `${func.moduleName} \\ ${func.functionParentName} \\ ${func.functionName}` : `${func.moduleName} \\ ${func.functionName}`}</Table.Cell>
<Table.Cell textAlign="left" verticalAlign="middle">{func.fullFunctionActionList}</Table.Cell>
<Table.Cell textAlign="center" verticalAlign="middle">
<GridInput name={`action_${func.functionId}`} value={func.functionActionList} onChange={this.onChange} />
</Table.Cell>
</Table.Row>
);
vậy khi cái FunctionListRender được thay đổi thì nó sẽ render lại cái FunctionRender hay là update lại cái FunctionRender vì em để ý khi thay đổi cái FunctionListRender để mà render lại thì trong Component GridInput sẽ ko nhận sự kiện shouldComponentUpdate () nên em nghĩ là lần 1 nó render và lần 2 nó render là 2 cái Component khác nhau có đúng ko ạ ?
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?