我想呈現一個組件的基於用戶輸入的次數。例如,我有一個問題,詢問您要創建多少個文件夾,並在文件夾旁邊提供一個數字。基於任何數字,我想要在屏幕上呈現該時間量(假設我在另一個文件中創建了一個框)。我該怎麼做呢?我是在我的Box.js文件(下面)或我的組件是App.js文件中執行此操作嗎?我需要一個簡單而詳細的解釋,因爲我是React的新手。根據用戶輸入呈現組件的次數
使用我的代碼引導陣營:
const Box = (props) => {
return (
<div>
<Col xs={12} sm={8} md={8} lg={8} smOffset={2} mdOffset={2} lgOffset={2} >
<Panel bsClass="panel">
<Form horizontal>
<Row>
<Col componentClass={ControlLabel} lg={6}>
How many boxes do you want to create?
</Col>
<Col lg={4}>
<FormControl placeholder="Enter a number..." />
</Col>
<Col lg={2}>
<Button type="submit">
<FaArrowRight style={arrowStyle} />
</Button>
</Col>
</Row>
</Form>
</Panel>
</Col>
</div>
)
};