BrowserRouter和HashRouter的区别

BrowserRouter:

  原理是H5的history API,IE9及以下不兼容,需要由web server支持,在web client这边window.location.pathname被react router解析,example.com/react/route

HashRouter:

  原理是URL的hash,不需要由web server支持,因为它的只有‘/’path需要由web server支持,而#/react/route URL不能被web server读取,在web client这边window,location.hash被react router解析,example.com/#/react/route

posted @ 2019-01-19 15:42  十里霜天  阅读(945)  评论(0)    收藏  举报