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
This package has issues:
In ToastProvider, you make state:
ToastProvider
const [toasts, setToasts] = React.useState<FullToastConfig[]>([]) // line 49
And when has a new toast, this state will be update, ToastProvider re-render, that mean children also re-render. This is an error of performance.
Should make the component as children of ToastProvider (Ex: ToastContainer) manage toasts state. This component is ForwardRefExoticComponent.
ToastContainer
toasts
ForwardRefExoticComponent
When add toast, let call add function from ref of ToastContainer
ref
In Context.tsx, I suggest code:
Context.tsx
const ToastProvider: React.FC<Omit<ToastContextType, 'toast'>> = ({
change to:
export type ToastProviderProps = Omit<ToastContextType, 'toast'>; const ToastProvider: React.FC<PropsWithChildren<ToastProviderProps >> = ({
The text was updated successfully, but these errors were encountered:
No branches or pull requests
This package has issues:
Re-render all app when add new a toast
In
ToastProvider
, you make state:And when has a new toast, this state will be update, ToastProvider re-render, that mean children also re-render. This is an error of performance.
Should make the component as children of
ToastProvider
(Ex:ToastContainer
) managetoasts
state. This component isForwardRefExoticComponent
.When add toast, let call add function from
ref
ofToastContainer
Support children for React 18
In
Context.tsx
, I suggest code:change to:
The text was updated successfully, but these errors were encountered: