Per the following links, I git cloned this and ran npm install in both the main directory and the example basic directory, and ran npm start to get a working example.
https://github.com/reactjs/react-router-redux
https://github.com/reactjs/react-router-redux/tree/master/examples/basic
https://github.com/reactjs/react-router-redux#pushlocation-replacelocation-gonumber-goback-goforward
Code to remove query params (close to the bottom) and validate that they're removed:
import { createStore, combineReducers, applyMiddleware } from 'redux'
import { browserHistory } from 'react-router'
import { syncHistoryWithStore, routerReducer, routerMiddleware, push } from 'react-router-redux'
import * as reducers from './reducers'
const reducer = combineReducers({
...reducers,
routing: routerReducer
})
const middleware = routerMiddleware(browserHistory)
const store = createStore(
reducer,
applyMiddleware(middleware)
)
const history = syncHistoryWithStore(browserHistory, store)
// Dispatch from anywhere like normal.
store.dispatch(push("/?test=ok"));
// store2.dispatch(push(history.createHref("/")));
var count = 0;
history.listen(location => {
console.log(location);
if (count > 1) { return; }
count++;
store.dispatch(push({ pathname:'/', search: '' })); // Drops the params
});
Check console and you'll see the query params (search) field is empty
push(...)?this.props.history.push(...)react-router-reduxcan please use push({ pathname:'/', search: '', hash:'#/hompage' })