From 6b7d68e2d838d2f3e413cfb73214639f6c8fc409 Mon Sep 17 00:00:00 2001 From: Nguyen Phat Date: Wed, 21 Oct 2020 22:18:07 +0700 Subject: [PATCH] Add package 'recompose' --- package.json | 2 ++ src/pages/_app.tsx | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a29e703..1058d64 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "react": "^16.13.1", "react-dom": "^16.13.1", "react-redux": "^7.2.0", + "recompose": "^0.30.0", "redux": "^4.0.5", "redux-saga": "^1.1.3" }, @@ -38,6 +39,7 @@ "@types/node": "^13.11.1", "@types/react": "^16.9.34", "@types/react-redux": "^7.1.7", + "@types/recompose": "^0.30.7", "@typescript-eslint/eslint-plugin": "^2.29.0", "@typescript-eslint/parser": "^2.29.0", "eslint": "^6.8.0", diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 54c32fa..4bf1ffc 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -1,4 +1,4 @@ -import { useEffect } from 'react'; +import { useEffect, ComponentType } from 'react'; import withRedux, { ReduxWrapperAppProps } from 'next-redux-wrapper'; import withReduxSaga from 'next-redux-saga'; @@ -7,6 +7,8 @@ import { AppContext } from 'next/app'; import { Provider } from 'react-redux'; import { ThemeProvider, CssBaseline } from '@material-ui/core'; +import { compose } from 'recompose'; + import configureStore from 'states/configureStore'; import { RootState } from 'states/rootReducer'; import MainLayout from 'layouts/Main'; @@ -36,7 +38,10 @@ function App({ Component, pageProps, store }: ReduxWrapperAppProps) { ); } -export default withRedux(configureStore)(withReduxSaga(App)); +export default compose( + withRedux(configureStore), + withReduxSaga, +)(App as ComponentType); App.getInitialProps = async ({ Component, ctx }: AppContext) => { const pageProps = Component.getInitialProps