Skip to content

feat: add React Router (Remix) framework adapter - #142

Merged
czaydev merged 2 commits into
mainfrom
feat/react-router-adapter
Oct 7, 2026
Merged

czaydev merged 2 commits into
mainfrom
feat/react-router-adapter

Conversation

@czaydev

@czaydev czaydev commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

What and why

Closes #96

Adds better-payment/react-router. toReactRouterHandler(source) returns a loader (GET) and an action (POST) for a splat resource route, so React Router v7 and Remix v2 apps mount the handler in one line:

// app/routes/api.pay.$.ts
import { toReactRouterHandler } from 'better-payment/react-router';
export const { loader, action } = toReactRouterHandler(getBetterPayment);

It wraps toFetchHandler and uses a structural { request: Request } type, so there is no dependency on react-router.

  • Subpath registered in tsup, package.json exports, vitest and tsconfig.examples.json aliases, size budget (1 kB; built size 0.25 kB gzip)
  • Added to the shared scenarios in tests/unit/adapters/adapters.test.ts (lazy source, GET through loader, POST through action)
  • Example in examples/frameworks.ts, docs section in English and Turkish (frameworks page, handler table, README), changeset

Checklist

  • pnpm lint, pnpm typecheck and pnpm test pass
  • Tests cover the change (and forged/invalid input for callbacks and signatures)
  • A changeset is included for user-facing changes (pnpm changeset)
  • Docs are updated in English and Turkish (node apps/web/scripts/check-translations.mjs), or no docs change is needed
  • New user-facing features include a <Since version="x.y.z" /> badge in their docs, or no badge is needed
  • No credentials, card numbers or personal data in code, tests, fixtures or logs

Adds better-payment/react-router, which returns a loader and an action for a
splat resource route. Closes #96.
@czaydev
czaydev requested a review from poyrazavsever as a code owner October 7, 2026 04:19
Copilot AI balanced review requested due to automatic review settings October 7, 2026 04:19
@vercel

vercel Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
better-payment-web-xhgb Ready Ready Preview Oct 7, 2026 4:21am UTC

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@czaydev czaydev self-assigned this Oct 7, 2026
@czaydev
czaydev merged commit 91b4590 into main Oct 7, 2026
7 checks passed
@czaydev
czaydev deleted the feat/react-router-adapter branch October 7, 2026 04:32
@czaydev czaydev mentioned this pull request Oct 7, 2026
23 of 62 tasks

This branch was successfully deployed

1 active deployment
Preview — 1d05a1d9 Deployed Oct 7, 2026 by vercel[bot]
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.

Framework adapter: React Router (Remix)

2 participants