I am building a project that displays some data from api and now I need to filter it.
I\'ve done the category filter and now I have to do a price range filter so bot
i have same problem with marge filters i have two filters and each one works fine but together not works only first work my code is
const [search, setSearch] = useState('');
const [select, setSelect] = useState('All');
const updateSearch = (e) => {
setSearch(e.target.value);
//console.log(search);
}
const updateSelect = (e) => {
setSelect(e.target.value);
//console.log(select);
}
const searchCountry = zemlje.filter((zemlja) => {
if (zemlja.name.toLowerCase().search(new RegExp(`^${search}`)) === 0) return true;
});
const selectCountry = zemlje.filter((zemlja) => {
if (select ==='All') return true;
if (zemlja.region === select) return true;
});
i want filter this base on search input and select drop menu
{searchCountry.map(zemlja => (
))}