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

177
Vistas
Identifying key for value in body when key is not explictly passed in

I am looking to identify how the body looks for following request.

This is existing code which sends a post call to another client and also redirects to that client.

When normally making a post call, I am expecting the body to look something like this.

{
    someKey: 'some value'
}

But in this case, only the value is being set. What is the key here?

//Just from a normal js file. 
export const postData = (myRef, token, link) => {

  // question is on this line. Just setting a value. What is the key for the post body?
  myRef.current.children[0].value = token;
  myRef.current.action = link;
  myRef.current.submit();
};

This is the component where on click we call above function where we post and redirect to link.

const AComponent = () => {
  const myRef = React.useRef();
  const submit = () => {
    postData(myRef, 'some long token', 'www.google.com');
  };

  return (
      {/* Button is just another component that acts like a normal html button with some styling*/}
    <Button onClick={submit}>
      Click Me!
    </Button>
  );
};

export default AComponent;
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can do this by creating an Object & then assigning {key: value} pair to it.

const obj = new Object();

obj['some key'] = "some value";

Maybe this is helpful to you, if still, this doesn't answer your question, you can ping me for further reference.

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