Skip to content

Commit

Permalink
feat(react): add comments to hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
aidenybai committed Jun 15, 2022
1 parent 0802981 commit 870ab76
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/react/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ export const useDeferredValue = (value: any) => {
return value;
};

// useSyncExternalStore
export const useSyncExternalStore = (subscribe, getSnapshot) => {
const state = useState(getSnapshot());
useEffect(() => {
Expand All @@ -227,6 +228,7 @@ export const useSyncExternalStore = (subscribe, getSnapshot) => {
return state;
};

// useImperativeHandle
export const useImperativeHandle = (ref, create) => {
if (ref?.current) {
const object = create();
Expand Down

0 comments on commit 870ab76

Please sign in to comment.