I have an array of objects like this:
"data": [
{
"id": 14,
"banner_type_id": 1,
"name": "banner2022",
},
{
"id": 12,
"banner_type_id": 1,
"name": "banner845",
},
{
"id": 8,
"banner_type_id": 4,
"name": "banner_powertools"
},
]
And these the code:
useEffect(() => {
getData();
}, []);
const getData = () => {
Axios.get(baseUrl)
.then(res => {
console.log('theres: ', res.data.data);
setBanner(res.data.data);
})
}
This result succeed get all-data. But, I just want display the data that only have banner_type_id ==4. What should I do?