Я пробую несколько решений, но ничего не получается,
Я только зацикливаюсь на своих маршрутах, но у меня все еще есть эта ошибка
Предупреждение: Ошибка типа проп: недопустимая пропа component
типа object
поставлено на Route
, ожидается function
. в Route (в Auth.js: 14) в Auth (создан ConnectFunction) в ConnectFunction (в App.js: 31) в Route (в App.js: 31) в Switch (в App.js: 29) в Router (созданный BrowserRouter) в BrowserRouter (в App.js: 27) в провайдере (в App.js: 26) в приложении (в src / index.js: 5)
// Auth.js
...
getRoutes = routes => {
return routes.map((rte, key) => {
if (rte.layout === "/auth") {
return (
<Route
path={rte.layout + rte.path}
component={rte.component}
key={key}
/>
);
} else {
return null;
}
});
};
...
// App.js
...
<Provider store={store}>
<Router>
<Fragment>
<Switch>
<PrivateRoute path="/admin" render={props => <AdminLayout {...props} />} />
<Route path="/auth" render={props => <AuthLayout {...props} />} />
<Redirect from="/" to="/auth/login" />
</Switch>
</Fragment>
</Router>
</Provider>
...