> For the complete documentation index, see [llms.txt](https://docs.chord.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chord.co/chord-oms/developer-tools/react/quick-start.md).

# Quick Start

## Installing

In order to install the necessary Chord packages, follow the guide below on how to configure your package manager to access Chord's packages.

[npm Access for @chordcommerce Packages](/chord-oms/developer-tools/developer-guides/npm-access-for-chordcommerce-packages.md)

After completing the steps in the guide above, you can install the package and its peer dependencies:

{% tabs %}
{% tab title="yarn" %}

```shell
yarn add @chordcommerce/react-autonomy @chordcommerce/chord-magic react react-dom react-redux redux
```

{% endtab %}

{% tab title="npm" %}

```none
npm install @chordcommerce/react-autonomy @chordcommerce/chord-magic react react-dom react-redux redux
```

{% endtab %}
{% endtabs %}

## Developing

Your application needs to be wrapped in the Function: ChordProvider component. `react-autonomy` keeps track of your application state and makes it available to components. For example, what is currently in a user's cart is automatically persisted. `<ChordProvider>` makes the state available throughout your application.

`<ChordProvider>` requires a configuration object with information about your storefront. Here's an example:

{% code title="<ChordProvider>" %}

```javascript
import ChordProvider from '@chordcommerce/react-autonomy'
import MagicClient from '@chordcommerce/chord-magic'

const App = ({ children }) => {
  const magicClient = new MagicClient(process.env.MAGIC_API_KEY)

  return (
    <ChordProvider
      config={{
        brandName: process.env.CHORD_OMS_BRAND_NAME,
        currency: 'USD',
        domain: process.env.CHORD_OMS_API_URL,
        locale: 'en-US',
        omsId: process.env.CHORD_OMS_ID,
        storeId: process.env.CHORD_OMS_STORE_ID,
        tenantId: process.env.CHORD_OMS_TENANT_ID
      }}
      authClient={magicClient}
    >
      {children}
    </ChordProvider>
  )
}
```

{% endcode %}

The `config` object requires these keys:

| Name        | Type   | Description                                                                                        |
| ----------- | ------ | -------------------------------------------------------------------------------------------------- |
| `brandName` | String | The store's name.                                                                                  |
| `currency`  | String | The store's currency. For example, `USD`.                                                          |
| `domain`    | String | The base URL of the OMS API to use for requests. For example, `https://my-store.assembly-api.com`. |
| `locale`    | String | The store's locale. For example, `en-US`.                                                          |
| `omsId`     | String | A unique identifier generated by Chord during provisioning.                                        |
| `storeId`   | String | A unique identifier generated by Chord during provisioning.                                        |
| `tenantId`  | String | A unique identifier generated by Chord during provisioning.                                        |

Once your application is wrapped in the `<ChordProvider>` component, you can use SDK methods throughout your code. For example, here's a React component for adding an item to the cart:

{% code title="<AddToCartButton>" %}

```javascript
import { useCart } from '@chordcommerce/react-autonomy'

export default () => {
  const { addToCart } = useCart()
  const onSubmit = ({ sku, quantity }) => {
    addToCart({ sku, quantity })
  }
}
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.chord.co/chord-oms/developer-tools/react/quick-start.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
