Replies: 2 comments 9 replies
-
Hello @JulienHe Maybe Hydrogen stack would be easier to handle without next JS, as react server components handle SSR, hydrogen uses react-router for routing instead of next-router, and vite for dev build which is based on esbuild (Go) and replaces next JS SWC (Rust) based routing. This is just my opinion and I could be wrong |
Beta Was this translation helpful? Give feedback.
3 replies
-
Maybe try to use |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Context
Hello folks,
During Hackdays I give a try with Hydrogen and Next.js but it was not ready as Next 11 did not handle React 18. I put some slides together to explain.
Next.js 12 came out a few days ago and it's coming with React 18, it was obvious that I will a try on it.
Troubles during the experiment
react-dom-router
not foundWhile installing Next.js and hydrogen, the first time I try to run the app, the build complain that
react-dom-router
was not found and I had to install it on my project even tho it was a hydrogen dependency.Resolution
yarn add react-dom-router
fixed the issue.Unexpected token 'export'
Once I had everything running, I started to import hydrogen in my app
and I got an error Unexpected token 'export' running and locate in the file
node_modules/@shopify/hydrogen/client.js
where the code isResolution
I think this one is more on Next.js as I used a transpiler to resolve it.
This let next-transpile-modules to transpile hydrogen and the error vanished.
From there I was able to build and publish everything on Vercel.
Error: This Hook is not supported in Server Components.
Once I did everything I wanted to make it run, I was really excited to start building with
useShopQuery
.So I take the example from the hydrogen template and made it in a way that I can show
product.id
for now, just to see if I got something.and this code produced the following error:
There is no resolution for it for now. I actually try to see if there was a way to bypass the check and I also pinged @jplhomer to explain a bit my situation.
My take on this experimentation
From the documentation, we are saying that Hydrogen is available to be tested with Next.js and also that useShopQuery is used to fetch data.
We probably need to specify that.
useShopQuery
is not meant to be used with Next.js or even any other framework but Hydrogen.I hope this is helpful for you! 👨💻
Beta Was this translation helpful? Give feedback.
All reactions