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 | />
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.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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"
Thanks very much for reading.
Did you have Formik and Yup installed?
Also, this part:
is pretty important. You've to remember to pass that in.