Transcript
00:00 Alright, so when the user submits and it blows up, we don't give them any recourse, they have to hit refresh. We want to do something better. And so we're going to come over here, we'll say reset error boundary, pull that out of our props. And then we'll add a try again button that has an on click handler for resetting the error boundary. Try again.
00:18 As we pass that function along, that function will get called when the user clicks on the button and we will be in a good place. So now if I try to submit, it blows up, we at least get this try again button. Click on that, resets it. Now we're still going to get error logs and all that stuff, that's still going to happen.
00:36 It may be a caught error, but it's not an error we want to have happen. And so we are still going to get those logged. But as far as the user is concerned, at least they have a reasonably good experience here. And as a reminder, if I have a bunch of information entered in here, it blows up, I try again, this is re-rendering or re-mounting the component.
00:55 It's a totally different instance. Any of the state that was stored inside of those inputs, that's now gone. So if you want to preserve that, you've got to do that separate, maybe store it in state higher or put it in some local storage thing or something like that. Because accidents happen and data can get lost.
01:13 So that's a different subject. But the idea is if you need to reset the error boundary, then you can do precisely that inside of your error fallback using the reset error boundary. This is something that you probably will do depending on how you're managing your error boundaries and whatever framework you're using. So definitely useful to understand.