Closed tetrachrome closed 3 years ago
Nevermind, I figured it out.
how you figured this issue?
Hi @tetrachrome. Would you mind sharing how you fixed this? I am having the exact same issue. Thanks in advance and great Cheetah Museum website :)
@tetrachrome what did u do to solve the issue? Having the same issue here.
I'm also having the same issue no matter which page I'm in react-snap will hydrate from the index page instead of the requested page. React snap builds the index files correctly as well the issue happens with the hydration. I'm using react-router v6.
add reactSnap
options in package.json
like this:
"reactSnap": {
"include": [ // this is routes that you want to render
"/",
"/about"
]
},
I'm also having the same issue no matter which page I'm in react-snap will hydrate from the index page instead of the requested page. React snap builds the index files correctly as well the issue happens with the hydration. I'm using react-router v6.
Hi @BlazeIsClone. Did you resolve your issue?
I'm also having the same issue no matter which page I'm in react-snap will hydrate from the index page instead of the requested page. React snap builds the index files correctly as well the issue happens with the hydration. I'm using react-router v6.
Hi @BlazeIsClone. Did you resolve your issue?
No actually ended up porting the application to NextJS. Apart from having to redo the routing and the data fetching layer. NextJS also provides pre-rendering out of the box aswell.
Thanks for your time, but NextJS doesn't work for me, i need to convert to ssg my react app((
Hi,
I have a vanilla React app created with CRA, and on top of it with
react-router
. MyApp.js
is essentially as follows:The structure of the site is very simple. Before I tried to adopt react-snap, going to
/
would land me at the home / landing page, going to/biology
would land me at the "Biology" page, and going to/history
would land me at the "History" page, etc.Now, after I followed the instructions in the README.md, when built my app and test locally at
localhost:5000
, I would always land at the home page no matter what url I enter into the browser. A proof of that would be:I'd expect NOT get the
index.html
, but get the compiled staticbuild/biology/index.html
, which is there.The static compile indeed worked.
I'm on pretty much the latest of everything, and nothing special besides that.
I spent almost 4 hours on this after a bunch Googling and Stackoverflowing, but still stuck π’.
The current version of the site is live at https://www.hope4cheetahs.org/. If you go to the site you'll see the structure, it's very straightforward.
Any help/pointer would be much appreciated. I really want to use react-snap. Thanks a ton in advance!!! πππ