Closed Volodymyr128 closed 8 years ago
This is by design. Validate is asynchronous and causes a re-render when completed.
You have access to the validation-strategy and can invoke validate()
directly if you wish to avoid re-render; this will not update the props passed to your component and could introduce hard to find bugs, use at your own risk.
Here is the API for invoking the validation directly:
validate(data = {}, joiSchema = {}, options = {}, callback)
Thanks for your support!
I agree that's error-prone. But suppose you have a form and submit button, the button should be disabled if form is invalid. Moreover, form initial data comes from Store - user may input something, close the form and then return to submit it. Then you'll want to validate form from inside render method. Won't it be great to have some out-of-the-box validation strategy to validate without re-rendring? Or maybe there is more simple way?
validate
method make components to be re-rendered, what is bad. It's bad because I need validation on rendering, which creates infinite loop.Is there any way to invoke
validate
without component re-rendering?