8 lines
280 B
TypeScript
8 lines
280 B
TypeScript
import { useSyncExternalStore } from "react";
|
|
import type { AppStore } from "@editor/store";
|
|
import type { AppState } from "@editor/state";
|
|
|
|
export function useAppState(store: AppStore): AppState {
|
|
return useSyncExternalStore(store.subscribe, store.getState, store.getState);
|
|
}
|