Skip to content

Instantly share code, notes, and snippets.

@iamandrewluca
Created October 21, 2021 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamandrewluca/7d8cd2f345e705824b5c59a9378c9cb4 to your computer and use it in GitHub Desktop.
Save iamandrewluca/7d8cd2f345e705824b5c59a9378c9cb4 to your computer and use it in GitHub Desktop.
// eslint-disable-next-line react-hooks/rules-of-hooks
let _store: ReturnType<typeof useReducer>
function useStore() {
const store = useRef(useReducer((s: any, a: any) => {
return {}
}, {}))
_store = _store ?? store.current
return _store
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment