DEV Community

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

Collapse
 
pjiocnic profile image
PJ

I'm getting the same error as Kishor but in ImageSearchPage.js

TypeError: Cannot read property 'query' of undefined

68 | type="text"
69 | name="query"
70 | placeholder="Keyword"

71 | value={values.query || ""}
| ^ 72 | onChange={handleChange}
73 | isInvalid={touched.description && errors.query}
74 | />

I do have
const schema = yup.object({
query: yup.string().required("Query is required"),
});

but still experiencing the problem. I don't think the problem is due to yup

Collapse
 
aumayeung profile image
John Au-Yeung

Did you destructure values property from the parameter?