Current section: Error Boundaries 59 exercises
Problem

Reset

Loading exercise

Transcript

00:00 Sometimes you might want the user to be able to try again like maybe this was a network error and they've connected to the Internet again, so they can just try again or whatever there could be situations where you want the user to be able to try what they were going to do over again, and so the

00:15 part of the props that your error fallback gets is this reset error boundary function you can stick that in a button and Call that at you know some when the user clicks that button, and it will reset the error boundary It's important for you to understand that React error boundary is not going to preserve the state of your component

00:35 It's very and you wouldn't want it to because it's possible that that state is what caused the error in the first place So it'll reset it as if we're loading the page for the first time or loading that component for the first time But yeah, this is how you would manage Resetting things to that state so the user can try again if you want to preserve their state as they're like entering in

00:56 The different you know option maybe they've got a really big form then they hit submit and it all goes away if you're worried about that happening, then you may want to save that to a secure place or local storage or something like that to Handle that particular situation so when the component loads up again You can load all that data from local stores, so they don't have to enter everything in again

01:18 We're not going that deep into this I just want to show you how to reset things so that the user can try again And so that's done with the reset error boundary. That's what you're going to be doing in this exercise. Have a good time