Performance: Why session-based auth follows web standards
This affects page load speed by controlling how authentication data is stored and sent, impacting network requests and rendering delays.
Using session cookies managed by Remix's built-in session API, automatically sent with requests by the browser.Storing auth tokens in localStorage and manually attaching them to every client-side fetch request to Remix loaders and actions.
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| localStorage token management | None | 0 | Low but delayed by JS execution | [X] Bad |
| Session cookies with Remix API | None | 0 | Low and fast due to native browser handling | [OK] Good |
userId after the request?const session = await storage.getSession(request.headers.get('Cookie'));
const userId = session.get('userId');const session = storage.getSession(request.headers.get('Cookie'));
const userId = session.get('userId');Pass the test and this pattern moves unknown