File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -16,16 +16,11 @@ import React, {
16
16
17
17
export const OUTSIDE_CLIENT_PROVIDER_ERROR =
18
18
'Cannot be used outside ClientProvider!' ;
19
+
19
20
export interface UpdateClientCtxType < T > {
20
21
updateClientCtx : ( props : Partial < T > ) => void ;
21
22
}
22
23
23
- const UPDATE_CLIENT_CTX = {
24
- updateClientCtx : ( ) => {
25
- throw new Error ( OUTSIDE_CLIENT_PROVIDER_ERROR ) ;
26
- } ,
27
- } ;
28
-
29
24
export const ClientContext = createContext < unknown | undefined > ( undefined ) ;
30
25
31
26
export const useClientContext = < T , > ( ) : T & UpdateClientCtxType < T > => {
@@ -58,7 +53,9 @@ export const ClientProvider = <T,>({
58
53
const [ contextValue , setContextValue ] = useState ( {
59
54
...defaultValue ,
60
55
...value ,
61
- ...UPDATE_CLIENT_CTX ,
56
+ updateClientCtx : ( _ : Partial < T > ) : void => {
57
+ throw new Error ( OUTSIDE_CLIENT_PROVIDER_ERROR ) ;
58
+ } ,
62
59
} ) ;
63
60
64
61
const updateContext = useCallback (
You can’t perform that action at this time.
0 commit comments