Check out example codes for "typescript check if element in array". It will help you in understanding the concepts better.

Code Example 1

const arr = [{foo: 'bar'}, {foo: 'bar'}, {foo: 'baz'}];
console.log(arr.find(e => e.foo === 'bar')); // {foo: 'bar'} (first match)
console.log(arr.some(e => e.foo === 'bar')); // true
console.log(arr.filter(e => e.foo === 'bar')); // [{foo: 'bar'}, {foo: 'bar'}]

Code Example 2

your_array.includes(the_element)

Learn ReactJs, React Native from akashmittal.com