V
V
val182019-02-10 13:33:34
React
val18, 2019-02-10 13:33:34

What is the difference between BrowserRouter and HashRouter in React?

What is the difference between BrowserRouter and HashRouter in React and how do they work, in what situations is it better to use?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
grinat, 2019-02-10
@val18

The first one uses history api, the second one uses fragments. You need to use the first one, because it was made to replace fragments. Or, if it is impossible to correctly configure redirects in the http server, then it makes sense to associate with fragments. In react-native, neither one nor the other can be used, routes must be intercepted there, and activities should be dynamically created on their basis.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question