show and hide div based on radio button click react
import React from "react";
function Radio () {
const [status, setStatus] = React.useState(0) // 0: no show, 1: show yes, 2: show no.
const radioHandler = (status) => {
setStatus(status);
};
return (
<>
<input type="radio" name="release" checked={status === 1} onClick={(e) => radioHandler(1)} />
<input type="radio" name="release" checked={status === 2} onClick={(e) => radioHandler(2)} />
{status === 1 && drawYesContent()}
{status === 2 && drawNoContent()}
</>
);
}
export default Radio;