You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
839 B
31 lines
839 B
import React, { useState, useEffect } from 'react';
|
|
|
|
interface Props {
|
|
updateData: () => void;
|
|
masImg: string[],
|
|
name: string,
|
|
label: string,
|
|
value: string,
|
|
}
|
|
|
|
export const RadioButton: React.FC<Props> = ({masImg, name, label, updateData, value }) => {
|
|
const [variable, setVariable] = useState(0);
|
|
const change = (e) => {
|
|
setVariable(e.target.value);
|
|
updateData(e.target.value);
|
|
}
|
|
return(
|
|
<div className='fieldset'>
|
|
{masImg.map((name, num) => <>
|
|
<input
|
|
type="radio"
|
|
name="radio"
|
|
className='radioButton'
|
|
value={num}
|
|
onChange={(e) =>change(e) }
|
|
checked={variable == num}
|
|
/> </>
|
|
)}
|
|
</div>
|
|
)
|
|
} |