Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.3k
Description
I think this is an issue with how react-redux handles the hot reloading of connected components. If you have a non-connected (dumb) component render a connected component as a wrapper component, any content within that wrapper will no longer be re-rendered on change.
_Connected component:_
class Form extends Component { constructor(props) { super(props); } render() { return ( <form> {this.props.children} </form> ); }}export default connect(...)(Form);_Dumb component rendering connected component:_
class LoginForm extends Component { constructor(props, context) { super(props, context); } render() { return ( <Form> this is a test </Form> ); }}Changing the textthis is a test will not cause the component to re-render. Replace<Form> with<div> and everything works as expected. Replaceconnect()(Form) with justForm and everything works as expected.
Repository demonstrating issue is available athttps://github.com/bunkat/counter. It is the react-redux counter example with babel6 hot loading and a new connected wrapper component.
To reproduce the issue:
- git clonehttps://github.com/bunkat/counter.git
- cd counter
- npm install
- npm start
- Open browser tohttp://localhost:3000
- Edit components/Counter.js
- Modify the render method, change Clicked to Not Clicked
The module will be updated via HMR, but the Counter component will not be rendered with the new text.