【发布时间】:2021-03-15 21:55:09
【问题描述】:
我在我的项目中使用 reactstrap customswitch。如何打开/关闭标签?
const ProfileSwitch = ({title, text, name, id, label}) => {
return <div className="profile-switch">
<div className="profile-switch__text">
<p>{title}</p>
<span>{text}</span>
</div>
<CustomInput type="switch" id={id} name={name} label={label} />
</div>
}
export default ProfileSwitch;
【问题讨论】:
-
标签开/关是什么意思,请详细说明?
-
props来自哪里?title, text, name, id, label是否存储在状态中? -
@AbuSufian 我的英语不好。 codesandbox.io/s/crimson-bash-ntd6e?file=/src/switch.js:349-355这里你可以看,我想当复选框未选中时,标签文本更改为关闭
-
@ZsoltMeszaros 在这里你可以看看codesandbox.io/s/crimson-bash-ntd6e?file=/src/switch.js:349-355
-
没关系,问题是你如何处理开/关状态
标签: reactjs react-hooks reactstrap