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

157
Vistas
Syntax error: Unexpected token, expected "{" (8:16) - Problem with arrow function

i'm new to React and i'm creating a form following a internet tutorial, but just in the start i've run into this error: Syntax error: Unexpected token, expected "{" (8:16)

This is my code:

import React from 'react';
import './App.css';
import Form from './components/Form.js';

const handleSubmit = values => alert(JSON.stringify(values));
const initialValues = {}

function App() =>(
  <div>
    <Form handleSubmit={handleSubmit} initialValues={initialValues} />
  </div>
)

export default App;
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Your function should be an arrow function:

const App = () => (
  <div>
    <Form handleSubmit={handleSubmit} initialValues={initialValues} />
  </div>
);

or a normal function with a return:

function App() {
  return (
    <div>
      <Form handleSubmit={handleSubmit} initialValues={initialValues} />
    </div>
  );
}

More about functions here.

about 4 years ago · Juan Pablo Isaza Denunciar

0

Additional you can pass the brackets comes after App if function has one parameter.

const App = parameterA => (
  <div>
    <Form handleSubmit={handleSubmit} initialValues={initialValues} />
  </div>
);

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