📌  相关文章
📜  基于单选按钮单击反应显示和隐藏 div - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:09.346000             🧑  作者: Mango

代码示例1
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 (
    <>
       radioHandler(1)} />
       radioHandler(2)} />
      {status === 1 && drawYesContent()}
      {status === 2 && drawNoContent()}
    
  );
}

export default Radio;