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

101
Vistas
Reset state instead of an empty string

Newbie here.

I'll try my best to explain the issue.

Basically, I have this function that populates a form with existing data if the person filling out the form is the same as the user that logged in.

I'm trying now to reverse this function, so that if the user undoes this function, the form resets - i.e. as if it wasn't filled.

My issue is that I want to reset back to the initial state of name.

The way input field is formatted, having name : null or name : "" makes the form look like it's "filled". Just with no characters in the field itself.

How would I go about this?

  const handleSameUser = useCallback(() => {
    const newState = !sameUser
    setSameUser(newState);
    if (newState && user) {
      handleUserDetails({
        name: user?.name,
        profilePic: user?.avatar,
      });
    } else {
      handleUserDetails({ profilePic: null, name: ""});
    }
  }, [sameUser, setSameUser, user]);

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