React - Create a Controlled Form

So, both my code and answer code show the same error on FCC console when clicking the submit button.

Uncaught TypeError: Cannot read properties of null (reading 'match')

The code itself:

class MyForm extends React.Component {
  constructor(props) {
    this.state = {
      input: '',
      submit: ''
    this.handleChange = this.handleChange.bind(this);
    this.handleSubmit = this.handleSubmit.bind(this);
  handleChange(event) {
  handleSubmit(event) {
      submit: this.state.input
  render() {
    return (
        <form onSubmit={this.handleSubmit}>
            onChange={this.handleChange} />
          <button type='submit'>Submit!</button>

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: React - Create a Controlled Form

Link to the challenge:

1 Like

Hi @pinheirogui

Your code is correct, it pass. Try to copy, reset the challenge and past it. Or just try again later on.

Good luck and happy coding!

ya,i have see his code and it works.i think he asked to know or understand the error shown on the console and also i do not understand it either.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.