React-router You cannot use the same route ... force History.push / reload component

I am trying to get my search bar to work correctly.
When doing a search, the router sends me to / list / (whatever I was looking for)

The search bar changes its route programmatically like this:

var pathname = '/list/';
        var query = {
            q: this.state.searchBar
        };
        hashHistory.push({pathname, query});  

/ list /: q has a componentDidMount function that sends a GET request to the database, but if I do a new search and allready is in '/ list /: q', the url is updated, but the component does not restart.

My problem: How can I make my component reboot when creating a new search, although it is already on the search route / 'list /: q'?

Corresponding Code:
Pastebin Link

+4
1

., componentWillReceiveProps .

0

Source: https://habr.com/ru/post/1666943/


All Articles