[英]Populate based on choice values in select field
一个非常简单的例子:
function Page(props) {
const [choice1, setChoice1] = React.useState(null)
const [choice2, setChoice2] = React.useState(null)
... as many as you need
const handleChoice1 = (event) => {
setChoice1(event.target.value)
}
... as many as you need
return (
<div>
Your page here with selections that call your handleChoice functions when users select them
</div>
<Popup open={open}>
<DisplayContent choice1={choice1} choice2={choice2} />
</Popup>
)
}
将您的 state 传递给<DisplayContent />
并相应地呈现正确的数据。 如果它们是 null,则不渲染。
我的例子过于简单,因为我不知道你是如何实现任何东西的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.