如本文所述,我试图在 React Redux 中实现 404 页面。我的路线如下:
import React from "react";
import {Provider} from "react-redux";
import {ConnectedRouter} from "react-router-redux";
import {Route} from "react-router";
import RootContainer from "../containers/RootContainer"
import NotFoundComponent from "../components/NotFoundComponent";
const routes = (history, store) => {
return (
<Provider store={store}>
<ConnectedRouter history={history}>
<div>
<Route path="/" component={RootContainer}/>
<Route path="*" component={NotFoundComponent}/>
</div>
</ConnectedRouter>
</Provider>
);
};
export default routes;
在此之后,我意识到NotFoundComponent
不断泄漏到RootContainer
. 知道为什么会这样吗?