Caution
@shopify/react-csrf-universal-provider
is deprecated.
Shopifolk, see Shopify/quilt-internal for information on the latest packages available for use internally.
A self-serializing/deserializing CSRF token provider that works for isomorphic applications.
yarn add @shopify/react-csrf-universal-provider
// App.tsx
import {CsrfUniversalProvider} from '@shopify/react-csrf-universal-provider';
function App({token}: {token?: string}) {
return (
<CsrfUniversalProvider value={token}>
{/* rest of the app */}
</CsrfUniversalProvider>
);
}