1

Dispatching the push action which was defined in mergeProps parameter of the react-redux connect() dispatches redux action but does not trigger url page change. I also wrapped the withRouter around the redux container but no seems to help.

//connect.js

import { Component } from './Component';
import { withRouter } from 'react-router-dom';
import { connect } from 'react-redux';
import { push } from 'connected-react-router';
import { onFetch, onUpdate } from '../action-creators';

export default withRouter(connect(state => state, 
{ 
            onFetch, 
            onUpdate,
            push
        },
        ( state, actions ) => ({
            ...state,
            onFetch: actions.onFetch,
            onUpdate: index => {
                actions.onUpdate( index );
                actions.push( `/${ index }` );
            }
        })
    )( Component ));

What can I do to also trigger actual page update along with the LOCATION_CNANGE redux action using the create-react-router package? At this point, only the connected-react-router middleware and the redux store are being updated but no actual page change.

Stephen Isienyi
  • 1,292
  • 3
  • 17
  • 29

1 Answers1

0

Fixed it by modifying a redirect 'from' prop.

Root cause: a redirect was placed at the end of the switch child routes list as a catchall rerouting to the main page. However, all requests (including valid ones except '/') went to the catchall redirect and were rerouted to main page.

Stephen Isienyi
  • 1,292
  • 3
  • 17
  • 29