I used react-router
, even tried <Redirect .. />
, I can't redirect to the /
, the main problem is the /
is out of the other routes, so I need to use <Redirect from=* to= />
, it seems to not work.
then I also need to prevent /main
redirecting to /
, I put the <Redirect .. >
after <Route component={MainView} path=main>
another requirement, how make the localhost:3000
to localhost:3000/
to use AppIndex IndexRoute
please check code below:
import MainView from 'components/MainView';
import ThemeIndex from 'components/ThemeIndex';
import AppIndex from 'components/ThemeIndex';
import Shop from 'components/Shop';
import App from 'components/App';
export default (
<Route component={App} path=/>
<IndexRoute component={AppIndex}></IndexRoute>
<Route component={MainView} path=main>
<IndexRoute component={ThemeIndex}></IndexRoute>
</Route>
<Redirect from=* to= />
</Route>
);
have any idea?