((props, ref) => {
const { prefixCls = 'w-radio-group', className, name, value, onChange, children, ...other } = props;
return (
{React.Children.toArray(children).map((child) => {
if (!child) return;
if (!React.isValidElement(child)) return child;
return React.cloneElement(child, {
...(child.props || {}),
...{
checked: child.props.value === value,
name,
onChange,
},
});
})}
);
});
export default RadioGroup;