

And then that's gonna kick off a timer for five seconds that if the user, you know, doesn't do anything, it's going to redirect them back to the homepage. Then because has error updated, it's going to call this component did update. That's going to call our Azure monitor or track j s or whatever. So that's going to kick us into component did catch. So return hasError true, right? That's going to update it. We call are get derived state from props. Just to walk through it, user hits and error. So 5,000 cuz it counts in milliseconds, right? Okay? Next thing here. So if, so if it has an error then set a timeout. This gets called anytime that the component updates itself, right. And then we're gonna make another life cycle method here component did update. So here I'm gonna say has error and I'm also gonna get a hidden state rather, redirect, redirect, false.

How would you do that? Well, up here from react router DOM, there's another component called redirect that anytime you render, it's just going to redirect somewhere. And then after five seconds, we're just going to redirect them back to the homepage. That's good behavior, right? We're going to show them an error message. So click here to go back to the home page. So let's head back to, our error boundary. > So let's make this even a little bit more robust, just to show you how to do redirects in react router. Transcript from the "Redirect on Error" Lesson
