which I am getting from REDUX. This is what I have done below. I just want to confirm whether is this the right way to do.
const teamData = useSelector((state) => state.team.teamData);
const { description, heading } = teamData;
const teamMembers = useSelector((state) => state.team.teamData.teamMembers);
如果可能的话,您应该
description
和heading
useSelector
选择了整个。
现在,如果在teamData
上有第三个属性,则可以说
teamData
并且
winStreak
更改,您的组件将恢复。因为这种变化导致
winStreak
改变。而您的
winData.teamStreak
正在观看
winData
如果你做useSelector
当您的组件时,您的组件将在winData
或const description = useSelector((state) => state.team.teamData.description);
const heading = useSelector((state) => state.team.teamData.heading );
更改时。因为您的description
现在观看这两个属性以进行更改。它不在乎heading
是否更改,仅在乎teamData.description
useSelector
teamData.heading`change.
,在您的情况下,您应该做
teamData
or
呼叫也首先观察到您不感兴趣的数据。