My app breaks when there is any javascript error.
I am aware of ErrorBoundary but my concern is why the whole app just crashes whenever there is any js error. I have never seen this kind of pattern in other frameworks. Ideally what should happen is just that particular component where error has occurred should stop working (functionality ) rest of the app should work I should be able to navigate between screens etc.
5 Replies
Actually, this is normal behavior for react, too. Many Component frameworks already include those to have the behavior you described; however, that might lead to cases where a part of a component fails and the rest of it carries on, even though it could be no longer useful without the failed part. Thus, ErrorBoundary is there to allow control over failure to allow failing gracefully.
I don't know but this is looking new. In Vue and react i haven't seen this kind of behaviour. But anyways thanks for explaining Alex..Really appreciate
FWIW I used to get the white screen of death all the time in React. Any error and it brought the entire app crashing down. Maybe you just write perfect React code!? 😉
Or use a component framework that encapsulates its components but default.
I think I will go with adding type safety across app instead of using any other framework 🥹 Solid is good