diff --git a/components/radio/radio-context.ts b/components/radio/radio-context.ts index 9a0ecb5..b29271b 100644 --- a/components/radio/radio-context.ts +++ b/components/radio/radio-context.ts @@ -1,7 +1,7 @@ import React from 'react' export interface RadioConfig { - updateState: (value: string) => void + updateState?: (value: string) => void disabledAll: boolean value?: string inGroup: boolean @@ -9,7 +9,6 @@ export interface RadioConfig { const defaultContext = { disabledAll: false, - updateState: () => {}, inGroup: false, } diff --git a/components/radio/radio.tsx b/components/radio/radio.tsx index 8480f5d..b449ad7 100644 --- a/components/radio/radio.tsx +++ b/components/radio/radio.tsx @@ -77,7 +77,7 @@ const Radio: React.FC> = ({ } setSelfChecked(!selfChecked) if (inGroup) { - updateState(radioValue as string) + updateState && updateState(radioValue as string) } onChange && onChange(selfEvent) }