MCPcopy Index your code
hub / github.com/react/react / warnOnInvalidCallback

Function warnOnInvalidCallback

packages/react-server/src/ReactFizzClassComponent.js:47–63  ·  view source on GitHub ↗
(callback: mixed)

Source from the content-addressed store, hash-verified

45}
46
47function warnOnInvalidCallback(callback: mixed) {
48 if (__DEV__) {
49 if (callback === null || typeof callback === 'function') {
50 return;
51 }
52 // eslint-disable-next-line react-internal/safe-string-coercion
53 const key = String(callback);
54 if (!didWarnOnInvalidCallback.has(key)) {
55 didWarnOnInvalidCallback.add(key);
56 console.error(
57 'Expected the last optional `callback` argument to be a ' +
58 'function. Instead received: %s.',
59 callback,
60 );
61 }
62 }
63}
64
65function warnOnUndefinedDerivedState(type: any, partialState: any) {
66 if (__DEV__) {

Callers 3

enqueueSetStateFunction · 0.70
enqueueReplaceStateFunction · 0.70
enqueueForceUpdateFunction · 0.70

Calls 3

addMethod · 0.80
hasMethod · 0.65
errorMethod · 0.65

Tested by

no test coverage detected