What way should I filter this table so returns table with rows only that matches the customAttribute value that comes from amplify auth and is set to state. This is will result of getting value: 'valke' and let's say there is 2 entries in table that has same value valke it would only show those in the table.
useEffect(() => {
Auth.currentUserInfo()
.then((res) => {
console.log("res: ", res);
setCustomer(res.attributes["custom:customer"]);
})
.catch((err) => {
console.error(err);
});
}, []);
Here I'm mapping the table. The value I want to compare to is the customer_name
value that comes from another array. If customer === customer_name
then show only those rows in the table. const customer_name
is there because the projects array has them as id
{
dataFiltered
.filter((customer) => customers.map((c) => c[1] === customer))
.map((project) => {
const customer_name = customers.map((c) => {
return c[0] === project[2] ? c[1] : null;
});
return (
<TableRow key={project[0]} hover={true}>
...
)
});
}