Reputation: 127
I have a requirement where I have to load some data from React to an input field index.html
. I have created:
<div id="root"></div>
<input type="text" id="input" name="fInput">
and in index.js
I am trying to access it and assign a value to it.
const root = ReactDOM.createRoot(document.getElementById("root"));
const myInput = document.getElementById("input");
myInput.value= "test";
But it is not working, can anyone help me with this?
Upvotes: 0
Views: 301