GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||
GeezerVison is showing github.com — fix(react): Change resetError to a function type property by wolfgang42 · Pull Request #26717 · getsentry/sentry-javascript Conversation
|
| resetError: () => this.resetErrorBoundary(), |
So, change the type to () => void, which matches what we actually pass and makes it clear that callers to not need to bind it as a method.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Typing it as a method is equivalent to:
resetError: (this: FallbackMethod) => void,
Thus, tools like `@typescript-eslint/unbound-method` would warn on normal
fallback code:
function Fallback({resetError}) {
return <button onClick={resetError}>Try again</button>;
}
However, the actual value here is an arrow function which does not care
about `this` at all:
resetError: () => this.resetErrorBoundary(),
So, change the type to `() => void`, which matches what we actually pass
and makes it clear that callers to not need to bind it as a method.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Hi @wolfgang42, thanks for the contribution. LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
This PR adds the external contributor to the CHANGELOG.md file, so that they are credited for their contribution. See #26717 Co-authored-by: msonnb <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.