Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

189
Views
TypeError: Cannot read properties of undefined (reading 'description')

I am trying to add a form in my todo app. In the field when I click for type something this shows an error. like this- TypeError: Cannot read properties of undefined (reading 'description')

I don't understand how to fix this. Please help.

Here is my TodoComponent File.

import React, { Component } from 'react';
import moment from 'moment';
import { Field, Form, Formik } from 'formik';

class TodoComponent extends Component {
  constructor(props) {
    super(props);

    this.state = {
      id: this.props.match.params.id,
      description: 'Learn Forms',
      targetDate: moment(new Date()).format('YYYY-MM-DD'),
    };
  }

  render() {
    return (
      <div>
        <h1>Todo</h1>
        <div className='container'>
          <Formik>
            {(props) => (
              <Form>
                <fieldset className='form-group'>
                  <label>Description</label>
                  <Field
                    className='form-control'
                    type='text'
                    name='description'
                  />
                </fieldset>
              </Form>
            )}
          </Formik>
        </div>
      </div>
    );
  }
}

export default TodoComponent;
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You are not providing initialValues to Formik. You should have something like -

<Formik initialValues={{ description: '' }} > ...
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!