大家好,我已經在我的新專案中安裝了 yup,但在匯入后出現以下錯誤。required 不匯出。我試圖改變匯入的位置,比如把它放在上面,但仍然沒有任何反應,請幫助我必須在我的反應應用程式上添加驗證。謝謝
我在我的應用程式中使用以下庫
"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.net-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"
},

uj5u.com熱心網友回復:
你需要使用一個模式型別喜歡Yup.string()或Yup.number()才可以使用required()。
只有模式有required道具:
BaseSchema, MixedSchema, BooleanSchema, StringSchema, NumberSchema, DateSchema, ObjectSchema, ArraySchema
它不是直接從 Yup 匯出的。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/372655.html
標籤:javascript 反应 github 新产品经理
