Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

83
Vistas
Functions are not valid as a React child when wraping Routes in App

I'm trying to wrap Routes using Layout component so it puts all content into a bootstrap 12 column grid.But it doesnt wrap my text inside Route components and I get a warning that functions are not valid as a React child. Here is the App.js code:

import './App.css';
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom'; 
import Home from './Home';
import Offers from './Offers';
import Financing from './Financing';
import Buying from './Buying';
import Contact from './Contact';
import Gallery from './Gallery';
import Search from './Search';
import Layout from './components/Layout';

function App() {
  return (
    <Fragment>
      <Layout> 
      <Router>
        <Routes>
        <Route path='/' element={Home} />
        <Route path='/fahrzeugangebote/' element={Offers} />
        <Route path='/finanzierung/' element={Financing} />
        <Route path='/fahrzeugankauf/' element={Buying} />
        <Route path='/galerie/' element={Gallery} />
        <Route path='/kontakt/' element={Contact} />
        <Route element={Search} />
        </Routes>
      </Router>
      </Layout>
    </Fragment>
  );
}

export default App;

And here is the code for Layout.js:

import  Container  from 'react-bootstrap/Container';

export const Layout = (props) => {
  return( 
  <Container>
      {props.children}
  </Container>
  )
};
export default Layout  ```
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

As you can see in the docs, you have to provide the elements like this (ReactElement):

<Route path='/' element={<Home />} />
<Route path='/fahrzeugangebote/' element={<Offers />} />
// etc
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda