Configuration
How to configure Rehook to work with different React frameworks.
Create configuration file
Begin by creating a file named rehook.config.ts
in your project. This is where you will house your configuration.
Here's the structure I typically follow:
.
├── src
│ ├── hooks
│ ├── ...
├── rehook.config.ts
└── ...
- use-history.ts
- use-local-storage.ts
Copy & paste
Copy & paste the configuration below:
// rehook.config.ts
export const VITE_DEFAULT_ENV_VARS = ['BASE_URL', 'NODE', 'MODE', 'DEV', 'PROD', 'SSR']
export const NEXT_DEFAULT_ENV_VARS = ['NODE_ENV', 'TZ']
type RehookConfig = {
framework: 'VITE' | 'NEXT'
ignoreDefaultEnv: boolean
}
export const rehookConfig: RehookConfig = {
framework: 'VITE' // or NEXT,
ignoreDefaultEnv: true, // This is for useEnv hook
}