Closed AleksandrSl closed 2 years ago
Yeap, let's throw an error (we can do it only in development mode since it is configuration issue and will be catched in development)
Send PR
Actually, this was done in https://github.com/logux/client/pull/78/
useClient
could returnundefined
, though types say that it shouldn'texport function useClient(): Client
Maybe adding something like this inuseClient()
will helpif (!context) throw new Error('Wrap component with ClientContext.Provider')
My background: I called
useClient
in storyBook component, wrapping the story component the wrong way, and gotcannot read type of undefined
. It took a while to get the essence of a problem :smile: