Created
February 1, 2022 11:24
-
-
Save jhonsore/abdf6f019fc2eb9d9cbca176777886ab to your computer and use it in GitHub Desktop.
SCC(State, Controller and Component) Pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useMemo, useState } from "react" | |
type TController = { | |
} | |
export const useController = () => { | |
const [data, setData] = useState({} as TController); | |
const [] = useMemo(() => { | |
return []; | |
}, [data]); | |
const update = (e:TController) => { | |
setData(e); | |
} | |
return { | |
state: { | |
data | |
}, | |
actions: { | |
update | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment