Skip to content

Commit

Permalink
feat: Do를 사용하도록 하는 hook인 useDo 구현 (CC-88)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunkkkk committed Jul 26, 2024
1 parent d3525a9 commit e84b65f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Caecae/src/Shared/Hyundux/Hooks/useDo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { useState } from "react";
import _State from "../State";
import store from "../Store";

function useDo<PayLoad>(initialState: _State<PayLoad>): PayLoad {
const [state, setState] = useState<_State<PayLoad>>(initialState);
store.subscribe(state, null, (newState) => {
setState(newState);
});
return state.payload;
}

export default useDo;

0 comments on commit e84b65f

Please sign in to comment.