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

118
Vistas
Data not fetching with custom url axios ReactJs

i am new in Reactjs and working on nextjs,I have following components (components/Trending.js) which is working with this url "https://jsonplaceholder.typicode.com/users" but whenever i changed url(My custom url which contaning api data) to "https://90d9-2405-201-5002-215b-6c7b-1f41-7a19-f145.in.ngrok.io/serges/api/blogs" then records is not fetching,Here is my code (components/Trending.js)

import React from 'react';
class Trending extends React.Component {
    state = {
        trending: []
      }
    componentDidMount() {
        axios.get('https://90d9-2405-201-5002-215b-6c7b-1f41-7a19-f145.in.ngrok.io/serges/api/blogs',
        )
          .then(res => {
            const trending = res.data;
            this.setState({ trending });
          })
      }
    render() {
      return (
        <div>
          <table className="table table-hover">
              {this.state.trending.map((post, index) => {
                 return (
                      <tr>
                      <td>
                          <h4>{post.name}</h4>
                      </td>
                      </tr>
                  )
              })}
          </table>
        </div>
      );
    }
  }

  export default Trending;
  import axios from 'axios';
about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

I think you need to import Axios at the top of the file.

about 4 years ago · Juan Pablo Isaza Denunciar

0

You need to check your browser's console and Network tab. Most probably it's the CORS issue

about 4 years ago · Juan Pablo Isaza Denunciar

0

This is a CORS issue. You should fix it on the server-side. Add the front-end application URL in the 'Access-Control-Allow-Origin' response header. For local development, you can create a proxy server.

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