@base-ui/react
Version:
Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.
16 lines • 707 B
JavaScript
import { ReactStore } from '@base-ui/utils/store';
/**
* A `ReactStore` whose state never changes.
*
* Useful for fallback stores that need to support normal store reads while detached from the
* component that owns real state. Context values may still contain mutable refs or maps.
*/
export class NullStore extends ReactStore {
// `update`/`set`/`notifyAll` funnel through `setState` in the base `Store`, so overriding
// `setState` alone would neutralize them today. They are overridden explicitly so the store stays
// inert even if a future base-class change stops routing a mutator through `setState`.
setState(_newState) {}
update(_changes) {}
set(_key, _value) {}
notifyAll() {}
}