Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

160
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda