Blog>
Snippets

Installing and Setting Up TanStack Config

Showcase the commands for installing TanStack Config via npm or yarn, followed by a basic example of setting up a default configuration file.
// Installing TanStack Config
const installCommand = 'npm install @tanstack/react-config';
// or, if you're using yarn
const yarnInstallCommand = 'yarn add @tanstack/react-config';
These commands illustrate how to install TanStack Config using npm or yarn.
import { createConfig } from '@tanstack/react-config';

// Setting up a basic configuration
const myConfig = createConfig({
  key: 'myConfigKey',
  default: {
    apiUrl: 'https://api.example.com',
    theme: 'light'
  }
});
This snippet shows how to import the 'createConfig' function from TanStack Config and set up a simple configuration with a default theme and API URL.