How to return a custom status code in a route handler?

I wish to respond to an invalid URL query parameter value with a 400 status code. As I understand, returning a custom HTTP status code in a route loader is not possible due to prerendering. But what I’m struggling to understand is how is something like notFound() able to be implemented?
Was this page helpful?