-
-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error boundaries #257
Comments
Fre does not support error boundaries yet, but there are plans to support them in the future, because ErrorBoundary is similar to Suspense, and takes advantage of the fallback feature of the fiber linked list. |
@jantimon hi, I am back. According to your issue, I implement this in fre, but it's worth noting that it's different from the API of react16. import { ErrorBoundary } from 'fre'
function errorFn(error){
console.error(error)
return <div>hello</div>
}
function App() {
return <ErrorBoundary fallback={errorFn}>
<A/>
</ErrorBoundary>
}
function A(){
throw 111
} Fre's ErrorBoundary is more like Suspense, it has a fallback props, which takes advantage of the fallback feature of linked list https://github.com/preactjs/preact/blob/master/hooks/src/index.js#L271 I also see that preact has a hooks API, but I don't think it's appropriate. Although it can catch errors, it doesn't conform to the semantics of fallback and boundary. Which do you think is better? |
does/will fre support error boundaries?
The text was updated successfully, but these errors were encountered: