# useNonce The `useNonce` hook returns the [content security policy](https://shopify.dev/docs/custom-storefronts/hydrogen/content-security-policy) nonce. Use the hook to manually add a nonce to third party scripts. The `Script` component automatically does this for you. Note, the nonce should never be available in the client, and should always return undefined in the browser. ```jsx import { Links, LiveReload, Meta, Outlet, Scripts, ScrollRestoration, } from '@remix-run/react'; import {useNonce} from '@shopify/hydrogen'; export default function App() { const nonce = useNonce(); return ( ); } ``` ```tsx import { Links, LiveReload, Meta, Outlet, Scripts, ScrollRestoration, } from '@remix-run/react'; import {useNonce} from '@shopify/hydrogen'; export default function App() { const nonce = useNonce(); return ( ); } ``` ## Props ### UseNonceGeneratedType #### Returns: useNonce = () => useContext(NonceContext) ## Related - [createContentSecurityPolicy](https://shopify.dev/docs/api/hydrogen/2024-01/utilities/createcontentsecuritypolicy) - [Script](https://shopify.dev/docs/api/hydrogen/2024-01/components/script)