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

147
Vistas
Why am I getting object object in my input box react jsx

I'm stuck on making component work.

console.log and localhost image

I think it's something to do with handleChange but I can't figure it out.

import React, { useState } from 'react';

export default function FindCountry({ setNews }) {
    const [idInput, setIdInput] = useState('');
    const [errors, setErrors] = useState('');
    function getCountryID() {
        const url = `https://newsapi.org/v2/top-headlines?country=${idInput}&apiKey=${process.env.REACT_APP_GIPHY_KEY}`;
        fetch(url)
            .then((res) => res.json())
            .then((res) => {
                console.log('We have data!', res);
                setIdInput(res);
                setErrors('');
            })
            .catch((error) => {
                console.error(error);
                setErrors('Invalid Input');
            });
    }

    function handleChange(e) {
        setIdInput(e.target.value); 
    }

    function handleSubmit(e) {
        e.preventDefault();
        getCountryID();
    }
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