Comments (3)
I got it working by doing this:
<ErrorMessage
errors={methods.formState.errors}
name={`${name}.root`} <-- This is important
render={({ message, messages }) => {
return (
<span >
{message}
</span>
);
}}
/>
from error-message.
has anyone got this fixed? above solution doesn't work for me.
from error-message.
For my case, yup resolver was causing the issue. (I was using Custom Hook with Resolver
Shown in this docs )
To address the problem,
I switched to using the @hookform/resolvers package.
However, I also discovered that using square brackets instead of a dotted name can resolve the issue.
For example, instead of test.${index}.lasttname
, you can use test[${index}].lastName
when defining the name property for a Controller component.
This may be a simpler solution for some cases.
This works because the square brackets align with the name that Yup uses.
Hope it helps someone
from error-message.
Related Issues (20)
- root.* error support HOT 1
- Unable to resolve path to module '@hookform/error-message' HOT 5
- Undefined message list for array validations
- Props as and render are not compatible HOT 5
- Styled components and as prop HOT 2
- Add className to directly render a div HOT 3
- Maybe not IE11 compatible? HOT 3
- Add LICENSE file
- Name prop is incompatible when using useFieldArray HOT 1
- dot syntax names
- If use V7 react hook form, npm doesn't works without "--force" flag HOT 3
- Does not work with React Hook Form v7 FormProvider HOT 9
- Documentation - "get" method HOT 3
- How to get error count HOT 1
- Doesn't work with a regular form for some reason HOT 1
- `as` prop does not take precedence over components HOT 2
- Object(...) is not a function HOT 5
- NextJS static build throws error unless errors object passed to ErrorMessage HOT 7
- Mind releasing a new version w/ the changes since december? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from error-message.