We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 963c2f5 commit 583c840Copy full SHA for 583c840
remix/lessons/04-responses-and-errors/lecture/NOTES.md
@@ -1,12 +1,13 @@
1
# Lecture Notes
2
3
```ts
4
-// If you want to respond to the component from a loader or action
5
-// with a non-200 error, you just use json() and set the http status
+// "RETURN" goes to component:
+return new Response('Invalid Data', { status: 400 })
6
return json({ error: 'Invalid Data' }, { status: 400 })
7
8
-// If you throw a response, the nearest error handler catches it
+// "THROW" goes to Error Boundary
9
throw new Response('Not found', { status: 404 })
10
+throw json('Not found', { status: 404 })
11
```
12
13
Docs: Remix will automatically catch errors and render the nearest error boundary for errors thrown while:
0 commit comments