SyncExternalStore Class
A simple SyncExternalStore for use with React’s useSyncExternalStore.
Signature
export declare class SyncExternalStore<T> Constructors
| Constructor | Description |
|---|---|
| (constructor)(initialState) | Creates a new SyncExternalStore. |
Properties
| Property | Type | Description |
|---|---|---|
| getSnapshot | () => T | The getSnapshot function to pass as the 2nd argument to useSyncExternalStore. |
| state | T | The current state of the store. Assigning a new value to this property will cause all subscribers to be notified. |
| subscribe | (onStoreChange: (value: T) => void) => () => void | The subscribe function to pass as the 1st argument to useSyncExternalStore. |