# gt-react: General Translation React SDK: SPA development translations URL: https://generaltranslation.com/en-US/docs/react/tutorials/spa-development-translations.mdx --- title: SPA development translations description: See translations update live while developing your single-page React app --- Development translations let you preview translated content as you edit your SPA. They require the GT compiler and a development API key. **Prerequisites:** - A single-page React app configured with the [SPA Quickstart](/docs/react/tutorials/quickstart-spa) - A development API key that starts with `gtx-dev-` ## Step 1: Install the compiler Install `@generaltranslation/compiler` as a development dependency: ```bash npm i -D @generaltranslation/compiler ``` ```bash yarn add --dev @generaltranslation/compiler ``` ```bash bun add --dev @generaltranslation/compiler ``` ```bash pnpm add --save-dev @generaltranslation/compiler ``` ## Step 2: Add the compiler plugin Add the plugin for your bundler. For Vite: ```ts title="vite.config.ts" import react from '@vitejs/plugin-react'; import { vite as gtCompiler } from '@generaltranslation/compiler'; // [!code highlight] import { defineConfig } from 'vite'; import gtConfig from './gt.config.json'; // [!code highlight] export default defineConfig({ plugins: [gtCompiler({ ...gtConfig }), react()], // [!code highlight] }); ``` `@generaltranslation/compiler` also exports `webpack`, `rollup`, and `esbuild` plugins. Import the plugin that matches your bundler. ```ts import { webpack as gtCompiler } from '@generaltranslation/compiler'; ``` ## Step 3: Add development credentials Get a development API key at [dash.generaltranslation.com](https://dash.generaltranslation.com/signup) or by running: ```bash npx gt auth ``` Then add your project ID and development API key to `.env.local`: ```bash title=".env.local" VITE_GT_PROJECT_ID="your-project-id" VITE_GT_DEV_API_KEY="your-dev-api-key" ``` `gt-react` reads these values automatically during initialization. **Development only:** Use a key starting with `gtx-dev-`. Never expose a production key that starts with `gtx-api-` in browser code. ## Step 4: Start developing Start your development server and switch to a non-default locale. When you edit translatable content, the compiler registers the change and `gt-react` requests an updated development translation. ## Next steps - [SPA Quickstart](/docs/react/tutorials/quickstart-spa) - Review the complete SPA setup - [Compiler](/docs/react/concepts/compiler) - Learn about compiler validation and automatic JSX injection - [Production vs Development](/docs/react/concepts/environments) - Understand how translation behavior changes by environment