Component.prototype.setState() callback is not receiving any arguments
See original GitHub issueDo you want to request a feature or report a bug?
Bug
What is the current behavior?
Component.prototype.setState()'s callback is not receiving any parameters, though line 47 in /packages/react/src/ReactBaseClasses.js states, that: It will be called with the up to date component arguments (state, props, context).
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn’t have dependencies other than React. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:
https://jsfiddle.net/n5u2wwjg/145295/
Please check the console after clicking the button, as it will display an empty array, indicating that it doesn’t get called with any parameters.
What is the expected behavior?
As the comment mentions, we should get the updated state and props and context as arguments.
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
I’m checking this behaviour in React v16.4.2 using Chrome 68, Mac OS High Sierra 10.13.6 and it also didn’t seem to work in previous versions, though I didn’t go back in the version history.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)

Top Related StackOverflow Question
You’re not looking at the right implementation. This is a shim.
The right one is here.
If you’d like to propose a change to the React API to include this, please do it here: https://github.com/reactjs/rfcs
Feel free to send a PR that removes the comment. The comment seems wrong.
Thanks for the information!