facebook/react · error · Error
Expected `${registrationName}` listener to be a function, in
Error message
Expected `${registrationName}` listener to be a function, instead got a value of `${typeof listener}` type. What it means
Error "Expected `${registrationName}` listener to be a function, instead got a value of `${typeof listener}` type." thrown in facebook/react.
Source
Thrown at packages/react-dom-bindings/src/events/getListener.js:72
): Function | null {
const stateNode = inst.stateNode;
if (stateNode === null) {
// Work in progress (ex: onload events in incremental mode).
return null;
}
const props = getFiberCurrentPropsFromNode(stateNode);
if (props === null) {
// Work in progress.
return null;
}
// $FlowFixMe[invalid-computed-prop]
const listener = props[registrationName];
if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
return null;
}
if (listener && typeof listener !== 'function') {
throw new Error(
`Expected \`${registrationName}\` listener to be a function, instead got a value of \`${typeof listener}\` type.`,
);
}
return listener;
}
View on GitHub (pinned to eafeac097b)
When it happens
Trigger: Thrown at packages/react-dom-bindings/src/events/getListener.js:72 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of facebook/react@eafeac097b (2026-08-21).
Data as JSON: /api/errors/6ffa6a6473112fed.
Report an issue: GitHub.