useSettings.ts
1 import { type AppState, useAppState } from '../state/AppState.js' 2 3 /** 4 * Settings type as stored in AppState (DeepImmutable wrapped). 5 * Use this type when you need to annotate variables that hold settings from useSettings(). 6 */ 7 export type ReadonlySettings = AppState['settings'] 8 9 /** 10 * React hook to access current settings from AppState. 11 * Settings automatically update when files change on disk via settingsChangeDetector. 12 * 13 * Use this instead of getSettings_DEPRECATED() in React components for reactive updates. 14 */ 15 export function useSettings(): ReadonlySettings { 16 return useAppState(s => s.settings) 17 }