When debug logging is enabled, warnings are generated when reloading a component that uses both hot and connect.
React Hot Loader version: 4.3.4
Run these commands in the project folder and fill in their results:
node -v: v10.8.0npm -v: 6.3.0Then, specify:
index.js
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { setConfig } from 'react-hot-loader';
import { createStore } from 'redux';
import Test from './Test';
setConfig({ logLevel: 'debug' });
const store = createStore((state = {}) => state);
// Wrap the rendering in a function:
ReactDOM.render(
<Provider store={store}>
<Test />
</Provider>,
document.getElementById('root')
);
Test.js
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { hot } from 'react-hot-loader';
class Test extends Component {
render() {
return <div>Test</div>;
}
}
export default hot(module)(connect()(Test));
React Hot Loader:, Non-controlled class Connect(Test) contains a new native or bound function setWrappedInstance 茠 setWrappedInstance(ref) {
this.wrappedInstance = ref;
} . Unable to reproduce
// Change bottom of Test.js
export default hot(module)(Test);
// Create TestRedux.js and use it in place of Test.js
import { connect } from 'react-redux';
import { hot } from 'react-hot-loader';
import Test from './Test';
export default connect()(Test);
That's not a bug - that's a feature of RHL v4.
RHL's babel plugin was not extended to your node_modules directory, thus RHL has no power upon classes defined there.
Meanwhile - everything is working, RHL just reporting that it could not do some replacements, but they are not needed for redux.
You can ignore this message(change logLevel), or remove it using cold API (but I have another issue related to it, so wait a bit before use)
@theKashey In my case, I'm getting the same error and connected components (i.e. dumb components) are not hot-loaded.
react-hot-loader: 4.6.3
@shahzaibkhalid - should work if _pre-connected_ part exists as a separate variable. That's also a good idea for better testing.
This root cause of this issue soon will be resolved - #1138
Yeah. In this case, I realized that the issue was with React-Redux and as I downgraded from v6.0.0 to v5.1.1, it started working.
Yeah. In this case, I realized that the issue was with
React-Reduxand as I downgraded fromv6.0.0tov5.1.1, it started working.
Thanks buddy, you save my day.
Would be fixed in react-redux v6.0.1 - https://github.com/reduxjs/react-redux/pull/1168
Most helpful comment
Thanks buddy, you save my day.