---
title: Script
description: >-
  Use the `Script` component to add third-party scripts to your app. It
  automatically adds a nonce attribute from your [content security
  policy](/docs/custom-storefronts/hydrogen/content-security-policy).
api_version: 2023-10
api_name: hydrogen
source_url:
  html: 'https://shopify.dev/docs/api/hydrogen/2023-10/components/script'
  md: 'https://shopify.dev/docs/api/hydrogen/2023-10/components/script.md'
---

# Script

Use the `Script` component to add third-party scripts to your app. It automatically adds a nonce attribute from your [content security policy](https://shopify.dev/docs/custom-storefronts/hydrogen/content-security-policy).

## Props

**`JSX.IntrinsicElements['script']`**

Examples

### Examples

* #### Example code

  ##### Description

  I am the default example

  ##### JavaScript

  ```jsx
  import {
    Links,
    LiveReload,
    Meta,
    Outlet,
    Scripts,
    ScrollRestoration,
  } from '@remix-run/react';
  import {useNonce, Script} from '@shopify/hydrogen';
  export default function App() {
    const nonce = useNonce();

    return (
      <html lang="en">
        <head>
          <meta charSet="utf-8" />
          <meta name="viewport" content="width=device-width,initial-scale=1" />
          <Meta />
          <Links />
        </head>
        <body>
          <Outlet />
          {/* Note you don't need to pass a nonce to the script component 
          because it's automatically added */}
          <Script src="https://some-custom-script.js" />
          <ScrollRestoration nonce={nonce} />
          <Scripts nonce={nonce} />
          <LiveReload nonce={nonce} />
        </body>
      </html>
    );
  }
  ```

  ##### TypeScript

  ```tsx
  import {
    Links,
    LiveReload,
    Meta,
    Outlet,
    Scripts,
    ScrollRestoration,
  } from '@remix-run/react';
  import {useNonce, Script} from '@shopify/hydrogen';
  export default function App() {
    const nonce = useNonce();

    return (
      <html lang="en">
        <head>
          <meta charSet="utf-8" />
          <meta name="viewport" content="width=device-width,initial-scale=1" />
          <Meta />
          <Links />
        </head>
        <body>
          <Outlet />
          {/* Note you don't need to pass a nonce to the script component 
          because it's automatically added */}
          <Script src="https://some-custom-script.js" />
          <ScrollRestoration nonce={nonce} />
          <Scripts nonce={nonce} />
          <LiveReload nonce={nonce} />
        </body>
      </html>
    );
  }
  ```

## Related

[- createContentSecurityPolicy](https://shopify.dev/docs/api/hydrogen/2023-10/utilities/createcontentsecuritypolicy)

[- useNonce](https://shopify.dev/docs/api/hydrogen/2023-10/hooks/usenonce)
