You can use the find or filter method of the array to find an entry that has a given url. Here is an example using the find method:
index.tsx366 chars11 linesIn the example above, we have an array of events that contains objects with id and url properties. We want to find an event that has a specific url, so we use the find method to iterate over the array and return the first event that has a url property that matches urlToFind.
The find method returns the found event object or undefined if no match is found.
You can also use the filter method to find all entries with a given url. Here is an example:
index.tsx424 chars11 linesIn this example, we use the filter method to return an array of all events that have a url property that matches urlToFind. The filter method returns a new array containing all the matching events.
gistlibby LogSnag