Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is simple-react-validator not compatible with React.memo? #268

Open
henrymcl opened this issue Sep 5, 2020 · 2 comments
Open

Is simple-react-validator not compatible with React.memo? #268

henrymcl opened this issue Sep 5, 2020 · 2 comments

Comments

@henrymcl
Copy link

henrymcl commented Sep 5, 2020

When I tried to improve performance by separating a field and add React.memo, the error messages stopped showing altogether.
Is there a way to make the error messages show even with React.memo?

@wztech0192
Copy link
Contributor

React.memo prevents rerendering of the component. If the component did not render then the message will not appear. Can you send some code examples, maybe we can come up with a solution?

@henrymcl
Copy link
Author

henrymcl commented Feb 5, 2021

Let's say I have a dynamic form with variable fields.
They are listed in the form of a table like this:
image

Now we I change the value of 1 row, it's ideal that the other rows do not re-render because nothing really is changed.
And to achieve that React.memo is often used, but in the case of sharing validator, is it possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants