refactor: use _name in case of radio button group is not being used

This commit is contained in:
jinhojang6 2023-03-10 00:06:42 +09:00
parent 5e25a92500
commit 521223d53b
No known key found for this signature in database
GPG Key ID: 0E7AA62CB0D9E6F3
1 changed files with 2 additions and 1 deletions

View File

@ -30,6 +30,7 @@ export const RadioButton: React.FC<RadioButtonProps> & {
defaultChecked,
disabled = false,
value,
name: _name,
inputProps = {},
children,
...props
@ -38,7 +39,7 @@ export const RadioButton: React.FC<RadioButtonProps> & {
const radioButtonGroup = useRadioButtonGroupContext()
const size = radioButtonGroup?.size ?? _size
const name = radioButtonGroup?.name ?? ''
const name = radioButtonGroup?.name ?? _name ?? ''
const selected = radioButtonGroup
? radioButtonGroup.value === value
: _checked