useSettings.ts
hooks/useSettings.ts
No strong subsystem tag
18
Lines
618
Bytes
2
Exports
1
Imports
10
Keywords
What this is
This page documents one file from the repository and includes its full source so you can read it without leaving the docs site.
Beginner explanation
This file is one piece of the larger system. Its name, directory, imports, and exports show where it fits. Start by reading the exports and related files first.
How it is used
Start from the exports list and related files. Those are the easiest clues for where this file fits into the system.
Expert explanation
Architecturally, this file intersects with general runtime concerns. It contains 18 lines, 1 detected imports, and 2 detected exports.
Important relationships
Detected exports
ReadonlySettingsuseSettings
Keywords
settingsappstateuseappstatewhenusesettingsreadonlysettingsreactstoreddeepimmutablewrapped
Detected imports
../state/AppState.js
Source notes
This page embeds the full file contents. Small or leaf files are still indexed honestly instead of being over-explained.
Full source
import { type AppState, useAppState } from '../state/AppState.js'
/**
* Settings type as stored in AppState (DeepImmutable wrapped).
* Use this type when you need to annotate variables that hold settings from useSettings().
*/
export type ReadonlySettings = AppState['settings']
/**
* React hook to access current settings from AppState.
* Settings automatically update when files change on disk via settingsChangeDetector.
*
* Use this instead of getSettings_DEPRECATED() in React components for reactive updates.
*/
export function useSettings(): ReadonlySettings {
return useAppState(s => s.settings)
}