Reputation: 21
The react-router document (history) said:
You might wonder why we don't fall back to hash history; the problem is that URLs become non-deterministic. If a visitor on hash history shares a URL with a visitor on browser history, and then they share that back, we end up with a terrible cartesian product of infinite potential URLs.
I got a little confused. An app only got one way to implement its history mechanism. A visitor shares a URL to another, they would both use browser history, or hash history. It is always the same.
Am I misunderstood something ? If not, why react router use browser history instead of hash history ? The hash history used to be the default history mechanism. Why change it ?
Upvotes: 2
Views: 3689
Reputation: 2139
You might wonder why we don't fall back to hash history
In general it might be a good idea to fall back so old browsers don't make full reloads when not supporting browserHistory.
However, this would cause the trouble which is described in the quotation you gave, thus they decided to not fall back to hashHistory if the browser doesn't support browserHistory.
if they would fall back, an user with an old browser would have different urls than an user with a modern browser.
Upvotes: 1