I'm trying to create element for example and tried to use jquery it works with jquery but how to use only reactjs
$("#myButton").on("click", function() {
$("#container").append('<div> <
label > enter name < /label> <
input onChange = {
this.onInputChange
}
type = "text"
placeholder = "what's your name" / >
<
/div>');
});
<div>
<label>enter name</label>
<input onChange={this.onInputChange} type="text" placeholder="what's your name" />
</div>
I don't want to use some state tricks like true show element , false don't show. what if i want to show infinite elements of the div above not one or even 10.
I've tried using this a callback function that will try to use React.createElement() method
React.createElement("div", null, React.createElement("label", null, "enter name"), React.createElement("input", {
onChange: this.onInputChange,
type: "text",
placeholder: "what's your name"
}));
The expected result is on button Click i use react and only reactjs to create element and append it in the parent div.