Is it correct to do history.push on button click?

  • 0
    Is it correct to do history.push on button click?

    There is a page with posts you can filter by category, type and author of the article.

    Is the correct approach when you click, for example, filtering a category, the id data of this category is saved in redux and then in the parent component it is pushed into history.

    If possible, you can leave links to articles, examples of how to implement it.
    JavaScript Anonymous, Jun 25, 2019

  • 1 Answers
  • 0
    In react, the URL history is managed by react Router ( https://reactrouter.com/ )

    If you're going to push a new URL, why not just navigate to it using React Router and then process the changed parameters?
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!