Q: react history push appends to url instead of replacing im trying to redirect my user to the detail page when he successfully creates an object from my list page. Here is my code:
history.js
import {createHashHistory} from 'history';
const history = createHashHistory();   
export default history

app.js
    class App extends Component {

  render() {    

        return (
          <Router history={history}>
            <Alerts/>
            <Switch>
                <PrivateRoute exact path="/" component={Main}/>
                <Route path="/login" component={Login}/>
            </Switch>
          </Router>
        )

  }
}

SAGA
export function* workerCreateTicket(action) {
...
...
yield call(forwardTo, `/tickets/${data.data.id}`); //<--- function to redirect if successful
...
}

function forwardTo(location) {
history.push(location);
}

Expected
I expected the URL to be as such:
http://127.0.0.1:3000/tickets/14

result
however i received this instead
http://127.0.0.1:3000/tickets#/tickets/14


A: It is about createHashHistory. You use hash-history, it means history-lib handle only part of url after hash (#).
You can switch it to createBrowserHistory, it handle whole url.

A: can you try pass a attribute (history) with your action when call in container.
=> workerCreateTicket(action)
const { history } = action;
