最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Attempted import error : 'required' is not exported from 'yup' - Stack Overflow

programmeradmin1浏览0评论

Hello everyone I've Installed the yup in my new project but after importing it i'm getting the following error . required is not exported . I tried to change the position of import like putting it on top but still nothing happens please help I have to add validations on my react App.Thanks

I'm using following libraries in my App

"dependencies": {
"@testing-library/jest-dom": "^5.15.0",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"axios": "^0.24.0",
"bootstrap": "^4.6.0",
"datatables-bs4": "^1.11.3",
"date-fns": "^2.26.0",
"formik": "^2.2.9",
"jquery": "^3.6.0",
"react": "^17.0.2",
"react-bootstrap": "^2.0.2",
"react-day-picker": "^7.4.10",
"react-dom": "^17.0.2",
"react-router-dom": "^6.0.2",
"react-scripts": "4.0.3",
"react-toastify": "^8.1.0",
"react-tooltip": "^4.2.21",
"react-yup": "^1.23.0",
"web-vitals": "^1.0.1",
"yup": "^0.32.11"

},

Hello everyone I've Installed the yup in my new project but after importing it i'm getting the following error . required is not exported . I tried to change the position of import like putting it on top but still nothing happens please help I have to add validations on my react App.Thanks

I'm using following libraries in my App

"dependencies": {
"@testing-library/jest-dom": "^5.15.0",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"axios": "^0.24.0",
"bootstrap": "^4.6.0",
"datatables-bs4": "^1.11.3",
"date-fns": "^2.26.0",
"formik": "^2.2.9",
"jquery": "^3.6.0",
"react": "^17.0.2",
"react-bootstrap": "^2.0.2",
"react-day-picker": "^7.4.10",
"react-dom": "^17.0.2",
"react-router-dom": "^6.0.2",
"react-scripts": "4.0.3",
"react-toastify": "^8.1.0",
"react-tooltip": "^4.2.21",
"react-yup": "^1.23.0",
"web-vitals": "^1.0.1",
"yup": "^0.32.11"

},

Share Improve this question asked Nov 30, 2021 at 20:46 afnanafnan 841 silver badge12 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

You need to use a schema type like Yup.string() or Yup.number() before you can use required().

Only schemas have the required prop:

BaseSchema, MixedSchema, BooleanSchema, StringSchema, NumberSchema, DateSchema, ObjectSchema, ArraySchema

It's not directly exported from Yup.

发布评论

评论列表(0)

  1. 暂无评论