mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-02-08 07:30:45 +03:00
41 lines
1019 B
JavaScript
41 lines
1019 B
JavaScript
import 'devui/lib/presets';
|
|
import React, { Component } from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import { Provider } from 'react-redux';
|
|
import configureStore from './store/configureStore';
|
|
import { CONNECT_REQUEST } from './constants/socketActionTypes';
|
|
import App from './containers/App';
|
|
|
|
class Root extends Component {
|
|
UNSAFE_componentWillMount() {
|
|
configureStore((store, preloadedState) => {
|
|
this.store = store;
|
|
store.dispatch({
|
|
type: CONNECT_REQUEST,
|
|
options: preloadedState.connection || this.props.socketOptions
|
|
});
|
|
this.forceUpdate();
|
|
});
|
|
}
|
|
|
|
render() {
|
|
if (!this.store) return null;
|
|
return (
|
|
<Provider store={this.store}>
|
|
<App {...this.props} />
|
|
</Provider>
|
|
);
|
|
}
|
|
}
|
|
|
|
Root.propTypes = {
|
|
socketOptions: PropTypes.shape({
|
|
hostname: PropTypes.string,
|
|
port: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
autoReconnect: PropTypes.bool,
|
|
secure: PropTypes.bool
|
|
})
|
|
};
|
|
|
|
export default Root;
|