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

127
Vistas
Will nesting async functions negatively affect performance?

I am working on a form submit and want to get the tokens on submit, because if I get them on page load load they might expire before use.

function handleSubmit(e) {
    e.preventDefault();

    async function getTokens() {
      return axios
        .get("example.com/get-token/306/")
        .then((response) => {
          return response.data;
        });
    }
    getTokens().then((data) => {
      async function submitForm() {
        const formData = new FormData();
        formData.append("token", data.message);
        formData.append("session", data.session);
        formData.append("email", email.current.value);

        const res = await axios.post(
          "https://example.com/submit/306/",
          formData,
          {
            headers: { "Content-Type": "multipart/form-data" },
          }
        );
      }
      submitForm();
    });
  }

Will this significantly decrease performance? The other method I tried is saving the tokens with setState on page load, but as I said this risks them expiring before use.

about 4 years ago · Juan Pablo Isaza
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