Skip to content

Commit 69c324f

Browse files
committed
refactor: use event callback for all notice removal
1 parent 2a6b071 commit 69c324f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/Notifications.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as React from 'react';
22
import type { ReactElement } from 'react';
33
import { createPortal } from 'react-dom';
44
import type { CSSMotionProps } from '@rc-component/motion';
5+
import { useEvent } from '@rc-component/util';
56
import NotificationList, {
67
type NotificationClassNames,
78
type NotificationListConfig,
@@ -119,7 +120,7 @@ const Notifications = React.forwardRef<NotificationsRef, NotificationsProps>((pr
119120
}, [configList]);
120121

121122
// ======================== Callback =======================
122-
const onAllNoticeRemoved = React.useCallback((placement: Placement) => {
123+
const onAllNoticeRemoved = useEvent((placement: Placement) => {
123124
setPlacements((originPlacements) => {
124125
const clone = {
125126
...originPlacements,
@@ -131,7 +132,7 @@ const Notifications = React.forwardRef<NotificationsRef, NotificationsProps>((pr
131132

132133
return clone;
133134
});
134-
}, []);
135+
});
135136

136137
// ======================== Effect =========================
137138
React.useEffect(() => {

0 commit comments

Comments
 (0)