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
Midhun Krishnan R -
Eric Allard -
yf-yang -
Can YM -
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')
);
});