I find the solution to render new fields according to inputed value. How to do it by the right way? I create the function that must return elements when user enter the value to input with id="players". For example, if user enter 5, then function should render 5 inputs in id="playersList".
function PrimaryInputs() {
const [playersQuantity, setPlayersQuantity] = useState(0);
function handleChange(event) {
setPlayersQuantity(event.target.value);
}
return (
<>
<div class="input_wrapper">
{playersQuantity}
<label htmlFor="players">How many players</label>
<input
type="number"
name="players"
id="players"
onChange={handleChange}
/>
<div id="playersList">
{playersQuantity.map(() => (
<div class="playersBlock">
<input
type="number"
placeholder="cups"
class="plCup"
/>
</div>
))}
</div>
</>
);
}