We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
https://codesandbox.io/s/blueprintjs-overlaytoaster-prop-problems-forked-7hhd2s
Similar to #6363, the React Component example does not work with React 18 when using ref. This example worked fine in v4.
ref
Change type of toaster to match React 18 private toaster: LegacyRef<OverlayToaster> | undefined;
toaster
private toaster: LegacyRef<OverlayToaster> | undefined;
The text was updated successfully, but these errors were encountered:
I forked your sandbox to add code which actually demonstrates the issue: https://codesandbox.io/p/sandbox/overlaytoaster-ref-bug-react-18-y9wz2r?file=%2Fsrc%2FApp.tsx%3A5%2C32
The "ref" usage pattern in question which causes errors with @types/react v18:
export default function App() { const toasterRef = React.createRef<Toaster>(); return <OverlayToaster position="top" ref={toasterRef} />; }
Turns out this doesn't work with React 16 either: https://codesandbox.io/p/sandbox/overlaytoaster-ref-bug-react-16-r9mv6n?welcome=true
You can fix this by using the OverlayToaster type for the ref object instead of Toaster.
OverlayToaster
Toaster
It does seem like the documentation has an error. I'll look into why the Toaster type is not assignable and I'll update the docs.
Sorry, something went wrong.
Fixed by #6165
adidahiya
No branches or pull requests
Environment
Code Sandbox
https://codesandbox.io/s/blueprintjs-overlaytoaster-prop-problems-forked-7hhd2s
Problem
Similar to #6363, the React Component example does not work with React 18 when using
ref
. This example worked fine in v4.Possible solution
Change type of
toaster
to match React 18private toaster: LegacyRef<OverlayToaster> | undefined;
The text was updated successfully, but these errors were encountered: