Skip to content

Commit

Permalink
Add note about why casting event.type to a topLevelType is safe
Browse files Browse the repository at this point in the history
  • Loading branch information
nhunzaker committed Sep 11, 2018
1 parent 7d2b2f1 commit 4e1f1a6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/react-dom/src/events/ReactDOMEventListener.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ function getTopLevelCallbackBookKeeping(
targetInst: Fiber | null,
ancestors: Array<Fiber>,
} {
// This is safe because DOMTopLevelTypes are always native event type strings
const topLevelType = unsafeCastStringToDOMTopLevelType(nativeEvent.type);

if (callbackBookkeepingPool.length) {
Expand Down

0 comments on commit 4e1f1a6

Please sign in to comment.