A user can select a filter their audiences with a dropdown of workspaces:
const selectedWorkspaces = [
{
name: 'workspace-foo',
uid: 'wk_12345',
...
},
{
name: 'workspace-bar',
uid: 'wk_54321',
...
},
];
lets say those ^ are the selected workspaces.
I then have a table that renders the audiences that have an array of workspaces they are a part of:
const audiences = [
{
uid: 'aud_1234',
workspaces: ['wk_12345', 'wk_47856', 'wk_23942'],
...
},
{
uid: 'aud_4321',
workspaces: ['wk_12345', 'wk_54321', 'wk_02394'],
...
},
{
uid: 'aud_9876',
workspaces: ['wk_54321', 'wk_23894', 'wk_02384'],
...
},
]
I would like to filter out the audiences that contain the selected workspaces and I am having difficulties understanding exactly how to do that. I want an array of audiences returned back to render and then when the filters are deselected render them all.
Any ideas as to compare two arrays of strings against each other? Admittedly loops are my weak point.