Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

261
Views
Rechazo no controlado (TypeError): no se puede acceder a la propiedad "país", this.props no está definido

estoy trabajando en una aplicación de reacción

cuando ejecute esta función con desplazamiento infinito, obtendré un error

Rechazo no controlado (TypeError): no se puede acceder a la propiedad "país", this.props no está definido

 async pageUpdater() { let url = `https://newsapi.org/v2/top-headlines?country=${this.props.country}&category=${this.props.category}&apiKey=myapi&page=${this.state.page}&pageSize=${this.props.pageSize}`; this.setState({ loading: true }) await fetch(url).then(response => response.json()).then(data => { this.setState({ articles: data.articles, totalResults: data.totalResults, loading: false }) }) }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Tiene que usar la función de flecha o necesita vincular this con esta función.

El JavaScript tiene el alcance de la función y el puntero this se cambia en el alcance de la función.

Por ejemplo-

 const pageUpdater = async () => { // your code here }

o

También puede vincular this con la función en el constructor del componente.

 constructor() { this.pageUpdater = this.pageUpdater.bind(this); }

Para obtener más información sobre this , lea https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!