I want to do something like that. Clicking the button will spawn input element. I checked some codes but all codes spawn like
food category food category food name food name
it should be order by clicked which button. How should I update my code?
const foodCategoryInput = () => {
}
function NewMenu() {
return (
<div>
<h1>Create New Menu</h1>
<button onClick={foodCategoryInput}>Add Food Category</button>
<button>Add Food Name</button>
<div id='menuItems'>
<input type='text' placeholder='Food Category'></input>
<input type='text' placeholder='Food Name'></input>
<input type='text' placeholder='Food Name'></input>
<input type='text' placeholder='Food Name'></input>
<input type='text' placeholder='Food Category'></input>
</div>
</div>
);
}
