Skip to content

docs(react): add server-rendered and SPA quickstarts#349

Merged
ErnestM1234 merged 10 commits into
mainfrom
e/react-spa-quickstart
Jul 13, 2026
Merged

docs(react): add server-rendered and SPA quickstarts#349
ErnestM1234 merged 10 commits into
mainfrom
e/react-spa-quickstart

Conversation

@ErnestM1234

@ErnestM1234 ErnestM1234 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Makes the server-rendered setup the primary gt-react quickstart at /docs/react, since that is the expected path for most React applications:

  • react/index — initializes server-rendered apps with initializeGT(), resolves each request with parseLocale(request), loads a translation snapshot, and passes it to <GTProvider>. An info callout directs client-only apps to the SPA quickstart.
  • react/tutorials/quickstart-spa — provides a focused client-only setup using initializeGTSPA(), module-level t(), and no provider. Compiler and development-key setup are intentionally optional.
  • react/tutorials/spa-development-translations — contains the optional compiler and development API-key setup for live translations while developing an SPA.
  • Navigation — keeps the primary quickstart in Getting Started and the SPA-specific guides under Tutorials.

Note on #340

These files overlap with the open Odysseus docs PR #340. If #340 merges first, this PR will need a small rebase; alternatively, the quickstart files can be dropped from #340.

Validation

  • pnpm --dir scripts validate-links
  • pnpm build:content

- Add tutorials/quickstart-spa: Vite-first setup with initializeGTSPA(),
  a bootstrap entry module awaited before render, and no provider
- Add tutorials/quickstart-ssr: initializeGT() at module scope, per-request
  getTranslationsSnapshot(locale) passed to <GTProvider>, with a concrete
  cookie -> Accept-Language -> default locale resolver using determineLocale
- Turn react/index into a chooser between the two quickstarts
@ErnestM1234
ErnestM1234 requested a review from a team as a code owner July 9, 2026 22:59
@ErnestM1234 ErnestM1234 changed the title docs(react): add SPA and server-rendered React quickstarts docs(react): add server-rendered and SPA quickstarts Jul 9, 2026
Comment thread docs/en-US/react/index.mdx Outdated
Comment thread docs/en-US/react/index.mdx Outdated
Comment thread docs/en-US/react/index.mdx Outdated
Comment thread docs/en-US/react/index.mdx Outdated
Comment thread docs/en-US/react/index.mdx Outdated
Comment thread docs/en-US/react/index.mdx Outdated
Comment thread docs/en-US/react/index.mdx Outdated
Comment thread docs/en-US/react/tutorials/quickstart-spa.mdx Outdated
Comment thread docs/en-US/react/tutorials/quickstart-spa.mdx Outdated
Comment thread docs/en-US/react/tutorials/quickstart-spa.mdx Outdated
Comment thread docs/en-US/react/tutorials/quickstart-spa.mdx Outdated
Comment thread docs/en-US/react/tutorials/quickstart-spa.mdx Outdated
Comment thread docs/en-US/react/tutorials/quickstart-spa.mdx Outdated
Comment thread docs/en-US/react/tutorials/quickstart-spa.mdx Outdated
@ErnestM1234
ErnestM1234 enabled auto-merge (squash) July 13, 2026 23:26

@logflash logflash left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ErnestM1234
ErnestM1234 merged commit b4fd009 into main Jul 13, 2026
7 checks passed
@ErnestM1234
ErnestM1234 deleted the e/react-spa-quickstart branch July 13, 2026 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants