I have this data:
subsInfo =
[
0: {username: "One", subId: 001, address: 123,},
1: {username: "Two", subId: 002, address: 456,},
2: {username: "Three", subId: 003, address: 789,},
]
I store the value of subId
and stored it in a useState:
const [subIdsArray, setSubIdsArray] = useState([]);
const [addressArray, setAddressArray] = useState([]);
var subIdKey = [001, 002, 003]
setSubIdsArray(subsIdKey);
var addressKey = [123, 456, 789]
setAddressArray(addressKey);
I want to filter the subsInfo
that has the value of subIdsArray
and addressArray
I am using functional component in javascript.
I tried the .filter + .map but didn’t work.