Giter Club home page Giter Club logo

Comments (3)

Treora avatar Treora commented on July 20, 2024

from redux-query-sync.

timmysmalls avatar timmysmalls commented on July 20, 2024

As far as I can tell the main difference between the two routers that affect this package is the arguments with which the eventhandler gets called on page changes. Other than that the two are very similar. Reach was created by one of the guys that created React router. I think perhaps an extra optional argument like "useReach: true" in the config could be all that's necessary. And then an optional import in case this argument is passed, so that it imports the historyListener from Reach, and subscribes to that listener to be alerted on page changes. I'll upload the changes I made this week. so you can check it out and see what you think. Should be very minimal. Thanks!

from redux-query-sync.

timmysmalls avatar timmysmalls commented on July 20, 2024

Getting it to work was quite easy, I have the version with my additional commit up on GitHub. All that's required to get it to work is to pass a custom history object to the middleware, which should the globalHistory object that comes with Reach router. Then you need to pass a flag reach: true to make two minor changes to the way the module works.

It shouldn't cause any issues, and it's very straightforward, but I'm not entirely happy with the way it panned out. I can live with the monkeypatch function, as it's just there to make the two API's compatible, but I'm not too thrilled about using the globalHistory module. Unfortunately Reach router's documentation is too limited at this point to be able to come up with something cleaner. In fact, as far as I can tell, the globalHistory object is not even mentioned in their docs at all.

So it's nice that I got it to work, but integrating it in other packages is probably not a good idea yet. Perhaps in the future.

from redux-query-sync.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.