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:
parent
95a6a872b6
commit
1b8bfc70f3
|
@ -23,13 +23,12 @@ const getOrCreateStore = (initStore, initialState) => {
|
||||||
export default (...args) => Component => {
|
export default (...args) => Component => {
|
||||||
// First argument is initStore, the rest are redux connect arguments and get passed
|
// First argument is initStore, the rest are redux connect arguments and get passed
|
||||||
const [initStore, ...connectArgs] = args
|
const [initStore, ...connectArgs] = args
|
||||||
|
// Connect page to redux with connect arguments
|
||||||
|
const ConnectedComponent = connect.apply(null, connectArgs)(Component)
|
||||||
|
|
||||||
const ComponentWithRematch = (props = {}) => {
|
const ComponentWithRematch = (props = {}) => {
|
||||||
const { store, initialProps, initialState } = 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
|
// Wrap with redux Provider with store
|
||||||
// Create connected page with initialProps
|
// Create connected page with initialProps
|
||||||
return React.createElement(
|
return React.createElement(
|
||||||
|
|
Loading…
Reference in a new issue