Answer the question
In order to leave comments, you need to log in
How to change Router?
I want to bring the routes to this form
const routes = [
{
path: "/",
exact: true,
component: Home
},
{
path: "/news",
component: News
}
];
const App = ({ location }) => (
<Switch>
<Route
location={location}
exact
path="/"
render={() => (<Articles documentTitleID="popular_articles_page.title" />)}
/>
</Switch>
)
Answer the question
In order to leave comments, you need to log in
{
routes.map(item => (
<Route
key={item.path}
exact={item.exact}
path={item.path}
component={item.component}
/>
))
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question