Fredrik
Fredrik
TTCTheo's Typesafe Cult
Created by Fredrik on 10/11/2023 in #questions
How does the top-level hook rule work within other hooks?
For example, is it OK to inline other hooks like so:
export const useToken = () => ({ value: useTokenStore(s => s.value) })
export const useToken = () => ({ value: useTokenStore(s => s.value) })
Or do you need to have it like so:
const useToken = () => {
const value = useTokenStore(s => s.value)
return { value }
}
const useToken = () => {
const value = useTokenStore(s => s.value)
return { value }
}
8 replies