Skip to content

sdk-react: SSR-safe hooks (Next.js App Router compat) #130

Description

@truthixify

Extra labels: react, nextjs, dx
Tier: M (2-4 days) | Type: feature

Context. sdk-react hooks reach for window on module load, breaking Next.js App Router server components. Guard every DOM access; ship a use client marker where required.

Scope.

  • Audit each hook file for module-scope DOM refs.
  • Move DOM refs behind useEffect / lazy init.
  • Add "use client" pragma where needed.
  • Example: examples/stellar-nextjs-app-router/.

Acceptance.

  • pnpm build on the Next.js example passes without SSR errors
  • Existing CRA + Vite examples still work
  • Tree-shakes: server bundle contains no DOM refs

Files. packages/sdk-react/src/hooks/, examples/stellar-nextjs-app-router/ (new).

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programdripsFunded via Drips NetworkdxDeveloper experiencehelp wantedExtra attention is needednextjsreact

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions