Skip to content

Commit 4e1f1a6

Browse files
committed
Add note about why casting event.type to a topLevelType is safe
1 parent 7d2b2f1 commit 4e1f1a6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

packages/react-dom/src/events/ReactDOMEventListener.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ function getTopLevelCallbackBookKeeping(
5757
targetInst: Fiber | null,
5858
ancestors: Array<Fiber>,
5959
} {
60+
// This is safe because DOMTopLevelTypes are always native event type strings
6061
const topLevelType = unsafeCastStringToDOMTopLevelType(nativeEvent.type);
6162

6263
if (callbackBookkeepingPool.length) {

0 commit comments

Comments
 (0)