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

382
Views
La función de envío de mi filtro no funciona según lo previsto. TypeError no detectado: country.match no es una función

Mi código no funciona específicamente con la función country.name.match que no funciona según lo previsto.

El código de error es el siguiente: App.js:27 TypeError no detectado: country.name.match no es una función

API REST en uso: https://restcountries.com/#api-endpoints-v3-all

Resto del código si es necesario: https://github.com/jnatividad-design/FSO/tree/main/part2/countries

 const handleFilterSubmit = (event) => { console.log(event.target.value) setNewFilter(event.target.value) const regex = new RegExp ( newFilter, 'i'); const filteredCountries = () => countries.filter(country => country.name.match(regex)); setCountries(filteredCountries) }

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Me di cuenta de lo que estaba mal. La API REST cambió ligeramente la estructura de la base de datos, agregando más especificidad al país y su nombre. En su lugar, originalmente era country.name , debe ser country.name.common ya que el nombre es otro objeto con propiedades como nombre común, nombre oficial, etc.

 const handleFilterSubmit = (event) => { console.log(event.target.value) setNewFilter(event.target.value) const regex = new RegExp ( newFilter, 'i'); const filteredCountries = () => countries.filter(country => country.name.common.match(regex)); setCountries(filteredCountries) }

about 4 years ago · Santiago Trujillo 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!