Accepted answer

When you've just refreshed the page, you don't have the data yet - the server did not respond yet - but you're already trying to filter it.

One way to solve is to check for Data to exist. Another way is conditional chaining, like this

Data?.filter(filterFunction) // if Data is present, it will be filtered

Related Query

More Query from same tag