[英]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.