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

161
Vistas
Api data not being displayed due to CORS -axios. ReactJS

I am making an api call to the steam review api with this link: "api link"

I have used another link with my code and was able to get responses and even display the data on my screen, so I have no faulty code. I am currently using this to try and get the result content: comment.reviews.review

This is my complete code:

function Home() {
  const [comments, setComments] = useState([]);
  useEffect(() => {
    fetchComments();
  }, []);
  useEffect(() => {
    console.log(comments);
  }, [comments]);
  const fetchComments = async () => {
    const response = await axios(
      "https://store.steampowered.com/appreviews/1389990?json=1&language=english"
    );
    setComments(response.data);
  };
  var limitComments = comments.slice(0, 3);

  return (
    {limitComments &&
       limitComments.map((comment) => (
          <p>{comment.reviews.review}</p>
                        
     ))}
   );
}

export default Home;

What is wrong with request? I have tried using different keys like comment.author.reviews.review.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You'll want to brush up on CORS since that's what's preventing your request from succeeding. Here's a great resource:

https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

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