Skip to content

Mention alternative of HashRouter #64

Open

Description

@deantork-sc

I was having problems with my SPA in Github Pages, and found a few solutions to the problem. This project fixes the problem in a roundabout way, and a slightly more direct solution is using HashRouter instead of BrowserRouter. I don't know if this fixes all instances of this problem, but it worked for me.

I think the readme should mention this alternative for folks who want a more lightweight solution.

Activity

  1. gatinhap commented on Mar 21, 2023

    @gatinhap

    @deantork-sc, thanks, for me it worked as well!

  2. lucharo commented on Apr 16, 2023

    @lucharo

    Do you have examples of how to achieve this? @deantork-sc @gatinhap

  3. gatinhap commented on Apr 17, 2023

    @gatinhap

    @lucharo - you can have a look into my repo where I use it - https://github.com/gatinhap/magdak and the specific file - https://github.com/gatinhap/magdak/blob/main/src/main.jsx.
    Instead of wrapping my <App/> in BrowserRouter, I wrapped it in HashRouter and that's all :)

  4. lucharo commented on Apr 28, 2023

    @lucharo

    Thanks for the reply I made it work in the end. I was confused at the fact I couldn't serve my builds folder with serve -s build when my package.json included my GitHub pages url as the homepage field but then I realised despite that the site does build correctly in gh pages itself 🎉 https://luischaves.xyz/recipe-portfolio https://github.com/lucharo/recipe-portfolio

  5. stxgao commented on Oct 29, 2023

    @stxgao

    Agree that this should be mentioned as an alternative.

    However, I wanted to add that I came here from my HashRouter implementation, since I wanted more shareable links (without the /#/ prefixing all my routes).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions