My code isn't working specifically with the country.name.match function not working as intended.
Error code is as follows: App.js:27 Uncaught TypeError: country.name.match is not a function
REST API being used: https://restcountries.com/#api-endpoints-v3-all
Rest of the code if needed: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)
}