hydrogen
hydrogen copied to clipboard
[Example]: RSC/SSR Cart with session
Description
A hydrogen example demonstrating a 💯 .server-driven basic Cart workflow.
- Provides a set of
cartutilities (getCart,createCart...) as well as a GraphQL cart client - Provides a
/api/cart/[action]that handle POST requests from the differentget,create,addandremoveform actions. - Persists
cartIdandcartCountto the session (cookie), so they can be used used during the.serverlifecycle - Uses form actions for all interactions with the API. e.g — AddToCart, remove..
- Provides
suspendedFna utility to enable<Suspend />friendly async API calls from.servercomponents
Additional context
Before submitting the PR, please make sure you do the following:
- [ ] Read the Contributing Guidelines
- [ ] Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g.
fixes #123) - [ ] Update docs in this repository according to your change
- [ ] Run
yarn changeset addif this PR cause a version bump based on Keep a Changelog and adheres to Semantic Versioning