1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Fix the bug with creating duplicate components of with-rematch example (#5440)

This commit is contained in:
zsx 2018-10-12 22:16:52 +08:00 committed by Tim Neutkens
parent 95a6a872b6
commit 1b8bfc70f3

View file

@ -23,13 +23,12 @@ const getOrCreateStore = (initStore, initialState) => {
export default (...args) => Component => {
// First argument is initStore, the rest are redux connect arguments and get passed
const [initStore, ...connectArgs] = args
// Connect page to redux with connect arguments
const ConnectedComponent = connect.apply(null, connectArgs)(Component)
const ComponentWithRematch = (props = {}) => {
const { store, initialProps, initialState } = props
// Connect page to redux with connect arguments
const ConnectedComponent = connect.apply(null, connectArgs)(Component)
// Wrap with redux Provider with store
// Create connected page with initialProps
return React.createElement(