From 4f179ec8e16ddf3e8913c0b228fe93044433d838 Mon Sep 17 00:00:00 2001 From: ABHINAV SHARMA Date: Fri, 25 Jun 2021 20:15:37 +0530 Subject: [PATCH] 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 --- client/gatsby-browser.js | 2 +- client/src/components/AppMountNotifier.js | 27 -------------------- client/src/components/app-mount-notifier.tsx | 27 ++++++++++++++++++++ 3 files changed, 28 insertions(+), 28 deletions(-) delete mode 100644 client/src/components/AppMountNotifier.js create mode 100644 client/src/components/app-mount-notifier.tsx diff --git a/client/gatsby-browser.js b/client/gatsby-browser.js index 97bb014d75..31bc7efb59 100644 --- a/client/gatsby-browser.js +++ b/client/gatsby-browser.js @@ -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(); diff --git a/client/src/components/AppMountNotifier.js b/client/src/components/AppMountNotifier.js deleted file mode 100644 index 60407d072f..0000000000 --- a/client/src/components/AppMountNotifier.js +++ /dev/null @@ -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); diff --git a/client/src/components/app-mount-notifier.tsx b/client/src/components/app-mount-notifier.tsx new file mode 100644 index 0000000000..2bcd979747 --- /dev/null +++ b/client/src/components/app-mount-notifier.tsx @@ -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) => + bindActionCreators({ appMount }, dispatch); + +type AppMountNotifierProps = { + appMount: () => void; + render: () => ReactNode; +}; + +class AppMountNotifier extends Component { + static displayName = 'AppMountNotifier'; + + componentDidMount() { + return this.props.appMount(); + } + render() { + return this.props.render(); + } +} + +export default connect(mapStateToProps, mapDispatchToProps)(AppMountNotifier);