There are two textboxes and one button designed as material UI components.
</p>
<TextField id="chatidField" />
<br />
<p>
<code>Enter Your Name:</code>
<hr />
</p>
<TextField id="nameField" />
<br />
<br />
<Button
variant="contained"
color="secondary"
onClick={addToFirebase()}
>
Get Your Token
</Button>
The function called by the onClick event is defined as:
function addToFirebase() {
var chatid = document.getElementById("chatidField").value;
var name = document.getElementById("nameField").value;
console.log(chatid, name);
}
An error message keeps appearing:
TypeError: Cannot read property 'value' of null
8 | var chatid = document.getElementById("chatidField").value;
9 | var name = document.getElementById("nameField").value;
Find the full code here: https://codesandbox.io/s/pqmrn4x