How to add radio buttons in cell within react table component?

i am new to programming with react and typescript and i am currently trying to add two radio buttons inside a react table row cell.

below is what i am aiming for.

enter image description here

as seen from above i want to add two radio buttons namely button1 and button2 to each row under radio buttons column. these radio buttons are shown only when user selects that row. by default button1 should be selected.

on selecting button2 we need to add the id of the selected row in an array. so for example if we select button2 of first row with id ‘1’ then array should contain [‘1′]. then if user selects second row with id’2’ then array should contain [‘1′,’2’]. now if user deselects button2 and selects button1 of second row with id ‘2’ then array should contain [‘1’].

i have tried below solution to do so,

CustomRadioButtonComponent.tsx

const CustomRadioButtonComponent: React.FC<SomeProps> = ({
    id,
    info,
    onBlur,
    onRadioButton1Change,
    onRadioButton2Change,
}) => {
    const handleRadioButton1Change: React.ChangeEventHandler<HTMLInputElement> =
        React.useCallback((event: any) => onRadioButton1Change(),
        [id, onRadioButton1Change]
    );

    const handleRadioButton2Change: React.ChangeEventHandler<HTMLInputElement> =
        React.useCallback((event: any) => {
            onRadioButton2Change(id, event.target.checked);
        }, [id, onRadioButton2Change]
    );
    return (
        <Flex flex={1}>
            <RadioButton
                name="radio"
                id="btn1"
                label="button1"
                onChange={handleRadioButton1Change}
                onBlur={onBlur}
                checked={info.length === 0}
         />
         <RadioButton
             name="radio"
             id="btn2"
             label="button2"
             checked={info.length > 0}
             onChange={handleRadioButton2Change}
             onBlur={onBlur}
         />
     </Flex>
 );

};

main.tsx

const mainStep: React.FC<MainStepProps> = props => {
    const info = values[INFO_KEY]; // form field value where we store the ids of 
    //selected rows

    
    const handleRadioButton1Change = React.useCallback(() => {
        setFieldValue(INFO_KEY, []); // WRONG LOGIC
    }, [setFieldValue]);

    const handleRadioButton2Change = React.useCallback(
        (id: any, state: any) => { // WRONG LOGIC
            const actualId = allInfoMap[id] ?? id;
            const infoAfterChange = state
                ? [...info, actualId]
                : info.filter(item => item !== actualId);
            setFieldValue(INFO_KEY, infoAfterChange);
     }, [info, setFieldValue, allInfoMap]
 );


    const columns: Column<Data>[] = [
        {
            Header: 'Name',
            id: 'name' ,
        } as ColumnWithId<Data>,x
        {
            Header: 'Radio buttons',
            id: 'radioButtons',
            accessor: ({ id, handleButton1Change, handleButton2Change, info, onBlur}) 
                => ({
                       id,
                       handleButton1Change,
                       handleButton2Change,
                       info,
                       onBlur,
                   }),
            Cell: ({
                      value: {
                          id,
                          handleButton1Change,
                          handleButton2Change,
                          info,
                          onBlur,
                      },
                      row: { selectState },
                  }) => {
                      if (selectState === 1) {
                          return (
                              <CustomRadioButtonComponent
                                  info = {info}
                                  onBlur={onBlur}
                                  id={id}
                                  onRadioButton1Change={handleRadioButton1Change}
                                  onRadioButton2Change={handleRadioButton2Change}
                               />
                           }
                       } as any,
                       {
                           Header: 'Version',
                           // version logic
                       },
                   ];
                 

    const tableData = React.useMemo(() =>
        data.map(item => {
            return {
                ...item,
                handleButton1Change(),
                handleButton2Change(),
                info,
            };
        }),[data, handleButton1Change, handleButton2Change, info];
    return (
        <Table<Data>
            data={tableData}
            columns={columns}
        />
    );
}

the problem with above code is that it doesnot select the right radiobuttons if i select button2 on row1 and then select button2 on row2 then the button2 on row 1 is deselected.

also the button1 is not selected on default.

could someone help me with this. thanks.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật