mirror of
https://github.com/zoriya/v10.git
synced 2026-08-15 02:14:06 +00:00
6 lines
255 B
TypeScript
6 lines
255 B
TypeScript
import { useSyncExternalStore } from 'react';
|
|
|
|
export function useExternalStore<T>(store: { subscribe: (listener: () => void) => () => void; getSnapshot: () => T }) {
|
|
return useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
|
|
}
|