如果redux中的某些内容发生更改,如何不更新Route渲染的组件?添加了一些路由示例,延迟导入的组件具有redux存储连接。
const ROUTES_OPTIONS = [
{
path: `${PATH_TO_SMART_ACCESS}${PATH_TO_SMART_ACCESS_VIEW}/options`,
Component: lazy(() => import("./SmartAccessActionsOptions")),
exact: false
},
{
path: `${PATH_TO_SMART_ACCESS}${PATH_TO_SMART_ACCESS_VIEW}/:id/options/:type?`,
Component: lazy(() => import("./SmartAccessActionsOptions")),
exact: false
}
];
const Routes = () => {
return (
<Switch>
{ROUTES_OPTIONS.map(route => (
<Route
key={route.path}
exact={route.exact}
render={() => {
const Component = route.Component;
return <Component />;
}}
/>
))}
</Switch>
);
};