Today When I switched from ejs to react I faced the error that document.getElementById is null, and when I went to the browser console, I could easily find it!
Here is my script:
document.getElementById("registerForm").addEventListener('submit', e => {
e.preventDefault();
...
})
Here Is The Error: Uncaught TypeError: document.getElementById(...) is null
and here is the snapshot of the browser console showing the element:
Please Help!
PS: I am a beginner to reactjs.