: [];但是,当我尝试呈现页面时,我得到以下内容:
ReactReactHooks must be called in the exact same order in every component render.Did you accidentally call a React Hook after an early return?react-hoo
- receives the state from the parent div and displays appropriately 它的工作方式是,当用户与菜单交互时,父菜单中的状态被更改,然后状态更改在属性中传递给主子div。这导致了性能问题,因为当菜单中发生变化时,应用程序必须重新呈现所有内容,并且存在如此多的状态变量可能是一个问题。 处理这个问题的最好方法是什么?
我的理解是,我可以使用自定义钩子(如这个钩子)从各个组件加载它来访问相同的状态,类似于redux允许我访问状态的方式。/hooks/useSelectedStore';
const { history } = props;
const [selectedStore我尝试在组件中使用这样的useEffect来获取更改并在重定向之前处理更改,但是在存储详细信息页面的组件上状态正在被重置。// Now