mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-11-28 05:45:41 +03:00
* stash * more * cli rename * Remove reference * Fix another reference * Fix scripts * Fix package name * Fix tsconfig
42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import 'devui/lib/presets';
|
|
import React, { Component } from 'react';
|
|
import { Provider } from 'react-redux';
|
|
import { Store } from 'redux';
|
|
import configureStore from './store/configureStore';
|
|
import { CONNECT_REQUEST } from './constants/socketActionTypes';
|
|
import App from './containers/App';
|
|
import { StoreState } from './reducers';
|
|
import { ConnectionOptions, StoreAction } from './actions';
|
|
|
|
interface Props {
|
|
socketOptions?: ConnectionOptions;
|
|
}
|
|
|
|
class Root extends Component<Props> {
|
|
store?: Store<StoreState, StoreAction>;
|
|
|
|
UNSAFE_componentWillMount() {
|
|
configureStore((store, preloadedState) => {
|
|
this.store = store;
|
|
store.dispatch({
|
|
type: CONNECT_REQUEST,
|
|
options: (preloadedState!.connection ||
|
|
this.props.socketOptions) as ConnectionOptions,
|
|
});
|
|
this.forceUpdate();
|
|
});
|
|
}
|
|
|
|
render() {
|
|
if (!this.store) return null;
|
|
const AppAsAny = App as any;
|
|
return (
|
|
<Provider store={this.store}>
|
|
<AppAsAny {...this.props} />
|
|
</Provider>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default Root;
|