I'm trying to change the name property of an input as the state of my component changes.
in short, this is What i'm trying to do.
let displayInputElement = (
<input
type="text"
name = {pips}
placeholder="Type your answer here"
className=" form-control"
/>
);
displayInputElement.props.name = "chicken";
But I'm getting the below error
TypeError: Cannot assign to read only property 'name' of object '#'
Please how can i achieve the below in react
displayInputElement.props.name = "chicken";
let pips = displayInputElement.props.name;
displayInputElement = (
<input
type="text"
name = "chicken"
placeholder="Type your answer here"
className=" form-control"
/>
);