Can you output static html with Gastby while using hooks? #29215
Unanswered
spencercolaco
asked this question in
Help
Replies: 1 comment
-
Yes absolutely, the page is run once so all hooks get run, the resulting dom tree is captured and that becomes the html static file. Your js will all get loaded and react will hydrate on the client and the hooks become functional. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
My team and I are currently shopping around for a new stack for the project we work on and have Gatsby and Svelte on our radar. I've never worked with either and have a question.
The project requires us to output compressed static HTML files with all JS and CSS embedded in the final HTML file. My question is: Would I be able to still take advantage of state management tools like React hooks inside my development environment that would then evaluate to embedded Vanilla JS in the final output static HTML file?
Ex:
useHover
https://usehooks.com/useHover/Does Gatsby have the ability to translate a hook like this into Vanilla JS in the final output?
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions