File tree Expand file tree Collapse file tree 8 files changed +14
-12
lines changed
Expand file tree Collapse file tree 8 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -8,9 +8,9 @@ export const createObserver = () => {
88 listeners . add ( fn ) ;
99 } ;
1010
11- const unsubscribe = ( fn : Listener ) => {
12- listeners . delete ( fn ) ;
13- } ;
11+ // const unsubscribe = (fn: Listener) => {
12+ // listeners.delete(fn);
13+ // };
1414
1515 const notify = ( ) => listeners . forEach ( ( listener ) => listener ( ) ) ;
1616
Original file line number Diff line number Diff line change @@ -2,5 +2,6 @@ import { type FunctionComponent } from "react";
22import { shallowEquals } from "../equals" ;
33
44export function memo < P extends object > ( Component : FunctionComponent < P > , equals = shallowEquals ) {
5+ console . log ( "memo" , equals ) ;
56 return Component ;
67}
Original file line number Diff line number Diff line change 11import type { AnyFunction } from "../types" ;
2- import { useCallback } from "./useCallback" ;
3- import { useRef } from "./useRef" ;
2+ // import { useCallback } from "./useCallback";
3+ // import { useRef } from "./useRef";
44
55export const useAutoCallback = < T extends AnyFunction > ( fn : T ) : T => {
66 return fn ;
Original file line number Diff line number Diff line change 11import type { RouterInstance } from "../Router" ;
22import type { AnyFunction } from "../types" ;
3- import { useSyncExternalStore } from "react" ;
3+ // import { useSyncExternalStore } from "react";
44import { useShallowSelector } from "./useShallowSelector" ;
55
66const defaultSelector = < T , S = T > ( state : T ) => state as unknown as S ;
Original file line number Diff line number Diff line change 1- import { useRef } from "react" ;
2- import { shallowEquals } from "../equals" ;
1+ // import { useRef } from "react";
2+ // import { shallowEquals } from "../equals";
33
44type Selector < T , S = T > = ( state : T ) => S ;
55
Original file line number Diff line number Diff line change 11import { useState } from "react" ;
2- import { shallowEquals } from "../equals" ;
2+ // import { shallowEquals } from "../equals";
33
4- export const useShallowState = < T > ( initialValue : Parameters < typeof useState < T > > [ 0 ] ) => {
4+ // initValue의 타입(T | (() => T)은 임의로 지은 것이므로 이후 수정 필요할지도
5+ export const useShallowState = < T > ( initialValue : T | ( ( ) => T ) ) => {
56 // useState를 사용하여 상태를 관리하고, shallowEquals를 사용하여 상태 변경을 감지하는 훅을 구현합니다.
67 return useState ( initialValue ) ;
78} ;
Original file line number Diff line number Diff line change 1- import { useSyncExternalStore } from "react" ;
1+ // import { useSyncExternalStore } from "react";
22import type { createStorage } from "../createStorage" ;
33
44type Storage < T > = ReturnType < typeof createStorage < T > > ;
Original file line number Diff line number Diff line change 11import type { createStore } from "../createStore" ;
2- import { useSyncExternalStore } from "react" ;
2+ // import { useSyncExternalStore } from "react";
33import { useShallowSelector } from "./useShallowSelector" ;
44
55type Store < T > = ReturnType < typeof createStore < T > > ;
You can’t perform that action at this time.
0 commit comments