# React





React apps scaffolded with Vite (via `create-vite` or `npm create vite`) output to `dist/` by default, which the CLI auto-detects.

Deploy [#deploy]

<Steps>
  <Step>
    Build your project [#build-your-project]

    <Tabs items="[&#x22;npm&#x22;, &#x22;bun&#x22;, &#x22;pnpm&#x22;]">
      <Tab value="npm">
        `bash npm run build `
      </Tab>

      <Tab value="bun">
        `bash bun run build `
      </Tab>

      <Tab value="pnpm">
        `bash pnpm build `
      </Tab>
    </Tabs>
  </Step>

  <Step>
    Deploy to Sample.app [#deploy-to-sampleapp]

    Since Vite uses `dist/` by default, auto-detection works:

    ```bash
    samplex deploy
    ```

    Or specify the directory explicitly:

    ```bash
    samplex deploy ./dist
    ```
  </Step>
</Steps>

Client-side routing [#client-side-routing]

If you're using React Router or TanStack Router, Sample.app's SPA fallback serves `/index.html` for all unmatched routes automatically.

<Callout type="info">
  No additional configuration needed — client-side routing works out of the box.
</Callout>

Custom output directory [#custom-output-directory]

If you've changed the output directory in your Vite config:

```ts title="vite.config.ts"
export default defineConfig({
  build: {
    outDir: "my-output",
  },
});
```

Pass it to the deploy command:

```bash
samplex deploy ./my-output
```

<Callout type="info">
  Auto-detection only looks for `dist`, `build`, and `out`. If you use a custom directory name, you
  must specify it explicitly.
</Callout>
