-
Notifications
You must be signed in to change notification settings - Fork 801
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
autobinding lifecycle method #1194
Comments
No changes made to |
Hi, I had this same problem, I had to rewrite step by step my class to discover why it's not rerendering, even updated other libraries or things related to #1120, but in the end this is the problem. It seems that when using Example: Here, if you change import React, { Component } from 'react'
import { connect } from 'react-redux';
import { Link, withRouter } from 'react-router-dom';
class Example extends Component {
componentDidMount(){};
render() {
return (
<div>
one
</div>
)
}
}
function mapStateToProps(state) {
return {};
}
function mapDispatchToProps(dispatch) {
return {};
}
export default withRouter(
connect(
mapStateToProps,
mapDispatchToProps,
)(Example),
); Here, that change will not work: import React, { Component } from 'react'
import { connect } from 'react-redux';
import { Link, withRouter } from 'react-router-dom';
class Example extends Component {
componentDidMount = () => {}
render() {
return (
<div>
one
</div>
)
}
}
function mapStateToProps(state) {
return {};
}
function mapDispatchToProps(dispatch) {
return {};
}
export default withRouter(
connect(
mapStateToProps,
mapDispatchToProps,
)(Example),
); I'm using Thanks! |
RHL uses Using "bound" versions of these methods is not letting RHL override them in an expected way, as well as update them in time. There is no reason to use an arrow version of these methods, no reasons to bind them. Probably the best solution here would be an eslint rule to stop you from doing that. |
Description
when component has
componentDidMount = () => {}
instead of
componentDidMount(){}
Hot loader identifies files to update and patch, but never rerenders.
Expected behavior
Should rerender, or WARN/LOG/ERROR. At the moment fails silently to reload the app.
At minimum big bold warning in docs....
"react-hot-loader": "4.7.1",
"react": "16.8.1",
The text was updated successfully, but these errors were encountered: