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, {
1616
1717export const OUTSIDE_CLIENT_PROVIDER_ERROR =
1818 'Cannot be used outside ClientProvider!' ;
19+
1920export interface UpdateClientCtxType < T > {
2021 updateClientCtx : ( props : Partial < T > ) => void ;
2122}
2223
23- const UPDATE_CLIENT_CTX = {
24- updateClientCtx : ( ) => {
25- throw new Error ( OUTSIDE_CLIENT_PROVIDER_ERROR ) ;
26- } ,
27- } ;
28-
2924export const ClientContext = createContext < unknown | undefined > ( undefined ) ;
3025
3126export const useClientContext = < T , > ( ) : T & UpdateClientCtxType < T > => {
@@ -58,7 +53,9 @@ export const ClientProvider = <T,>({
5853 const [ contextValue , setContextValue ] = useState ( {
5954 ...defaultValue ,
6055 ...value ,
61- ...UPDATE_CLIENT_CTX ,
56+ updateClientCtx : ( _ : Partial < T > ) : void => {
57+ throw new Error ( OUTSIDE_CLIENT_PROVIDER_ERROR ) ;
58+ } ,
6259 } ) ;
6360
6461 const updateContext = useCallback (
You can’t perform that action at this time.
0 commit comments