It will say that name and are undefined but I don't know why and how to fix it.
My code:
It will say that name and are undefined but I don't know why and how to fix it.
My code:
For further actions, you may consider blocking this person and/or reporting abuse
Javad İbrahimli -
chintanonweb -
Hamza Khan -
M1dnightGMR -
Top comments (1)
const phoneExp = /\(?![0])|[0])[0-9](?[0-9])?[0-9]*$/;
const formValid = formErrors => {
let valid = true;
Object.values(formErrors).forEach(val => {
val.length > 0 && (valid = false);
});
}
class App extends React.Component {
constructor(props) {
super(props)
this.state={
nameInput: null,
phoneInput: null,
formErrors:{
nameInput:"",
phoneInput:""
}
}
}
handleSubmit = e =>{
e.preventDefault();
if(formValid(this.state.formErrors)){
console.log(
);--SUBMITTED--
--nameInput:${this.state.nameInput}
--phoneInput:${this.state.phoneInput}
}else{
console.log(
error
)}
}
}
document.addEventListener('DOMContentLoaded', function () {
ReactDOM.render(
,
document.getElementById('app')
);
});