question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using hash history instead of browser history?

See original GitHub issue

On previous versions we were able to pass a hash history to the connectRoutes function, like:

const history = createHashHistory()

export const {reducer, middleware, enhancer} = connectRoutes(
  history,
  routesMap,
  options
)

It seems like now, with history handled internally, there is no way to use hash history anymore, is that correct and intended?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
faceyspaceycommented, Sep 19, 2017

Thanks for pointing this out.

There is now a createHistory option which you can pass the hash history to or your own fork/implementation etc. Eg:

import createHashHistory from 'history/createHashHistory'

connectRoutes(routesMap, { createHistory: createHashHistory })

Otherwise, for anyone reading this, if you’re not passing your own createHistory factory, RFR will automatically pick the memory or browser history automatically for you based on the environment it detects. I.e. on the server or React Native it will pick createMemoryHistory and if in the browser it will pick createBrowserHistory 😃

1reaction
chanandcommented, Oct 10, 2017

@faceyspacey I’m using the hash history because I’m deploying a single page app (with no SSR) while I have no control on the hosting server.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - What is the difference between hashHistory and ...
3) Browser History in static file server will have one real location on our server to fetch our HTML from while Hash history...
Read more >
A little bit of history - Medium
Browser and hash histories are both intended to be used in a browser. They interact with the history and location web APIs so...
Read more >
What is the difference between browser history and hash ...
hashHistory uses URL hashes, along with a query key to keep track of state. hashHistory requires no additional server configuration, but is generally...
Read more >
React Router: hashHistory vs browserHistory - Egghead.io
In this lesson we'll look at hashHistory which uses a hash hack to track our route changes vs browserHistory which delivers clean urls,...
Read more >
Histories · React Router
browserHistory uses the HTML5 History API when available, and falls back to ... hashHistory uses URL hashes, along with a query key to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found