-
Notifications
You must be signed in to change notification settings - Fork 799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use react-hot-loader/patch
,I can't setState in function that bind 'this' in constructor
#597
Comments
I think this is a duplicate of #313. This occurs when you are targeting only at recent browsers with native |
I'm having the same issue. Targeting ES6 |
I know this bug, we have to add a test for it. It is relative to babel plugin that doesn't work with native |
I close it because it's a duplicate of #313 |
Description
When I use react-hot-loader,I put the
react-hot-loader/patch
in the first line of the entryindex
file,then in theapp
file,I create one react Component which only has 2 input.the difference of the 2 inputs is that one bind anonChange
function which bindthis
in theconstructor
and another input bind anonChange
function which bindthis
inrender
.I expect that the 2 input has the same behavior,but not so in real.the input bindonChange
function which bindthis
inconstructor
got an errorsetState(...): Can only update a mounted or mounting component.
But when i remove the
react-hot-loader/patch
from the entry file,the 2 input has the same behavior.I don't know why it is this.Expected behavior
a react component bind an event function that bind
this
inconstructor
can callsetState
correactlyActual behavior
when a react component bind an event function that bind
this
inconstructor
,when i call setState,it throw an errorWarning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the _default component.
Environment
React Hot Loader version:3.0.0-beta.7
Run these commands in the project folder and fill in their results:
node -v
:7.9.0npm -v
:4.2.0Reproducible Demo
react-hot-loader-bind-this-test
The text was updated successfully, but these errors were encountered: