feat(client) ts-migrate AppMountNotifier Component (#42585)
* feat(client) Renamed AppMountNotifier.js to app-mount-notifier.tsx * feat(client) ts-migrate AppMountNotifier Component * remove type package from root Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
f3d106dbff
commit
4f179ec8e1
@ -5,7 +5,7 @@ import { I18nextProvider } from 'react-i18next';
|
||||
|
||||
import i18n from './i18n/config';
|
||||
import { createStore } from './src/redux/createStore';
|
||||
import AppMountNotifier from './src/components/AppMountNotifier';
|
||||
import AppMountNotifier from './src/components/app-mount-notifier';
|
||||
import layoutSelector from './utils/gatsby/layoutSelector';
|
||||
|
||||
const store = createStore();
|
||||
|
@ -1,27 +0,0 @@
|
||||
import { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { bindActionCreators } from 'redux';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { appMount } from '../redux';
|
||||
|
||||
const mapStateToProps = () => ({});
|
||||
const mapDispatchToProps = dispatch =>
|
||||
bindActionCreators({ appMount }, dispatch);
|
||||
|
||||
class AppMountNotifier extends Component {
|
||||
componentDidMount() {
|
||||
return this.props.appMount();
|
||||
}
|
||||
render() {
|
||||
return this.props.render();
|
||||
}
|
||||
}
|
||||
|
||||
AppMountNotifier.displayName = 'AppMountNotifier';
|
||||
AppMountNotifier.propTypes = {
|
||||
appMount: PropTypes.func.isRequired,
|
||||
render: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(AppMountNotifier);
|
27
client/src/components/app-mount-notifier.tsx
Normal file
27
client/src/components/app-mount-notifier.tsx
Normal file
@ -0,0 +1,27 @@
|
||||
import { Component, ReactNode } from 'react';
|
||||
import { AnyAction, bindActionCreators, Dispatch } from 'redux';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { appMount } from '../redux';
|
||||
|
||||
const mapStateToProps = () => ({});
|
||||
const mapDispatchToProps = (dispatch: Dispatch<AnyAction>) =>
|
||||
bindActionCreators({ appMount }, dispatch);
|
||||
|
||||
type AppMountNotifierProps = {
|
||||
appMount: () => void;
|
||||
render: () => ReactNode;
|
||||
};
|
||||
|
||||
class AppMountNotifier extends Component<AppMountNotifierProps> {
|
||||
static displayName = 'AppMountNotifier';
|
||||
|
||||
componentDidMount() {
|
||||
return this.props.appMount();
|
||||
}
|
||||
render() {
|
||||
return this.props.render();
|
||||
}
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(AppMountNotifier);
|
Reference in New Issue
Block a user