React: Uncaught TypeError: this.updater.enqueueCallback is not a function when using setState callback

Created on 28 Jul 2017  路  10Comments  路  Source: facebook/react

Do you want to request a feature or report a bug?

Bug on a beta version.

What is the current behavior?

image

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template: https://jsfiddle.net/84v837e9/).

In my Component, I used a pretty simple piece of code:

  doSomeMore = () => {
    // Do stuff
  }

  doSomething = (value) => {
    this.setState({ value }, this.doSomeMore );
  }

firing doSomething() causes this error.

What is the expected behavior?

I expect this.doSomeMore function to be called after this.setState from this.doSomething.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

Version of React: 16.0.0-beta.2
I have tested several other versions and I can confirm that:

  • This bug also appears on 16.0.0-beta.1
  • This bug does NOT appear on 15.6.1

Most helpful comment

Please run npm ls react. You'll find that some package brings in the wrong version of React because it puts it in dependencies rather than peerDependencies. Please file an issue with that project.

All 10 comments

From your stack trace it is visible that you have 15 of React package but 16 of ReactDOM. Can you try same versions please?

@gaearon should we maybe fail early or at least warn if we detect a major version mismatch?

Oh damn, shame on me. Indeed it was a version mismatch.

Closing since there is no issue. We can discuss warning on version mismatch in a separate issue if you would like!

I am having this issue since updating to react 16 with lots of packages.

react-tooltip is one

react-google-maps is another

with my package.json showing:

    "react": "^16.0.0",
    "react-dom": "^16.0.0",

Please run npm ls react. You'll find that some package brings in the wrong version of React because it puts it in dependencies rather than peerDependencies. Please file an issue with that project.

Cool, thanks Dan!

So that did fix it. It was a module that is not actually included anywhere in my file anymore. May be worth adding something in the release notes to have the user run yarn list react or npm ls react to check their dependencies as you had said.

Removing that package seemed to fix all the issues instantly.

For the record, I had this error from an Enzyme 3.0 adapter using a React 16 adapter, when my React version was 15.

Changing adapters solved the issue.

I am facing following issue can anybody help me out
The issue occurs when I am trying to use callback function for react-x-editable component.

Uncaught TypeError: this.updater.enqueueCallback is not a function
at t.r.setState (editable.js:28)
at t.n.onSubmit (editable.js:28)
at HTMLUnknownElement.callCallback (react-dom.development.js:100)
at Object.invokeGuardedCallbackDev (react-dom.development.js:138)
at Object.invokeGuardedCallback (react-dom.development.js:187)
at Object.invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:201)
at executeDispatch (react-dom.development.js:461)
at executeDispatchesInOrder (react-dom.development.js:483)
at executeDispatchesAndRelease (react-dom.development.js:581)
at executeDispatchesAndReleaseTopLevel (react-dom.development.js:592)
at forEachAccumulated (react-dom.development.js:562)
at runEventsInBatch (react-dom.development.js:723)
at runExtractedEventsInBatch (react-dom.development.js:732)
at handleTopLevel (react-dom.development.js:4472)
at batchedUpdates$1 (react-dom.development.js:16537)
at batchedUpdates (react-dom.development.js:2131)
at dispatchEvent (react-dom.development.js:4551)
at interactiveUpdates$1 (react-dom.development.js:16592)
at interactiveUpdates (react-dom.development.js:2150)
at dispatchInteractiveEvent (react-dom.development.js:4528)
r.setState @ editable.js:28
n.onSubmit @ editable.js:28
callCallback @ react-dom.development.js:100
invokeGuardedCallbackDev @ react-dom.development.js:138
invokeGuardedCallback @ react-dom.development.js:187
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:201
executeDispatch @ react-dom.development.js:461
executeDispatchesInOrder @ react-dom.development.js:483
executeDispatchesAndRelease @ react-dom.development.js:581
executeDispatchesAndReleaseTopLevel @ react-dom.development.js:592
forEachAccumulated @ react-dom.development.js:562
runEventsInBatch @ react-dom.development.js:723
runExtractedEventsInBatch @ react-dom.development.js:732
handleTopLevel @ react-dom.development.js:4472
batchedUpdates$1 @ react-dom.development.js:16537
batchedUpdates @ react-dom.development.js:2131
dispatchEvent @ react-dom.development.js:4551
interactiveUpdates$1 @ react-dom.development.js:16592
interactiveUpdates @ react-dom.development.js:2150
dispatchInteractiveEvent @ react-dom.development.js:4528

Was this page helpful?
0 / 5 - 0 ratings