Coder Social home page Coder Social logo

Comments (6)

larrymyers avatar larrymyers commented on July 25, 2024

Yes. Hash urls are fully supported.

from react-mini-router.

EXC-BAD-ACCESS avatar EXC-BAD-ACCESS commented on July 25, 2024

are they not supported when using history=true by chance? i have:

routes: {
'/': 'home',
'#chapter4': 'chapter4', // not sure if this is necessary i'm really expecting home to be called with a hash parameter of some kind
}

home: function(path, params) {
//...
}

chapter4: function(path, params) {
// ...
}

and if i click the link from my first question the home function is called with path={"": undefined} params=undefined, and if i dump my state object state.path="/"

i'm using [email protected] from npm

from react-mini-router.

larrymyers avatar larrymyers commented on July 25, 2024

Yes, you're mixing concepts here, it's undefined behavior. If you want to use pushState browser history it really only understands paths. Including hash or query params in the route definition really doesn't make sense.

from react-mini-router.

EXC-BAD-ACCESS avatar EXC-BAD-ACCESS commented on July 25, 2024

fair enough. then is it either possible to tell react-mini-router to ignore my hash links, or is there any conceptual reason why the hash couldn't be retained and passed into the route functions so i could deal with the hash myself?

e.g. : chapter4: function(path, params, hash) // perhaps hash is a bad naming choice here

if the later doesn't break anything conceptually i'd happily submit a pull request for your review.

from react-mini-router.

larrymyers avatar larrymyers commented on July 25, 2024

If you're using pushState is there something you need to capture in the hash that you couldn't via query param? usually if you're using browser pushState there's no need for the hash in the url.

from react-mini-router.

EXC-BAD-ACCESS avatar EXC-BAD-ACCESS commented on July 25, 2024

back when i learned html (like 20 years ago so my knowledge is way out of date) there were two things that could happen when you clicked on a link:

  1. it goes to a different page: <a href="/someotherpage">link</a>
  2. it scrolls the browser to a location within the current page: <a href="#inpage">link</a>

so with react-mini-router all the type 1 links work fine, but all of the type 2 links are broken because react-mini-router is (i believe) intercepting them, dropping the "#inpage", and calling the route (so taking me to the correct page, but dropping the info needed to scroll).

maybe it's a well known thing (that i just don't know) that in a single page app type 2 links are just not done and you have to use some other tag like <button> with an onclick handler and scroll the page yourself?

from react-mini-router.

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.