Skip to content
12 linesCodeBlameRaw

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

The site's pages run only their own scripts: a nonce policy, nosniff, a referrer policy and no framing1import { createContext, useContext } from "react";
2
3/**
4 * The nonce the page's inline scripts carry, which its Content-Security-Policy
5 * names (lib/page-headers.ts). Given by entry.server.tsx; in the browser
6 * there is none, and none is needed: the scripts have already run.
7 */
8export const NonceContext = createContext<string | undefined>(undefined);
9
10export function useNonce(): string | undefined {
11 return useContext(NonceContext);
12}