DEV Community

Discussion on: How to Add Infinite Scrolling to Your React App

Collapse
 
kctripathy profile image
Kishor Tripathy

Hi John,
Thanks for this nice article.
I am novice to React.
Was trying to replicate the given code but getting an error in image & video search at line no 57.
Can you please help me to find out why it throws the error?

TypeError: Cannot read property 'query' of undefined
(anonymous function)
D:/Learn/React/react-examples/image-app/src/VideoSearchPage.js:57
54 | type="text"

55 | name="query"

56 | placeholder="Keyword"

57 | value={values.query || ''}

| ^ 58 | onChange={handleChange}

59 | isInvalid={touched.description && errors.query}

60 | />

Collapse
 
aumayeung profile image
John Au-Yeung

Thanks very much for reading.

Did you have Formik and Yup installed?

Also, this part:

const schema = yup.object({  
  query: yup.string().required('Query is required'),  
});

is pretty important. You've to remember to pass that in.