You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can you clarify the use case for this? In the above example, the values should be set in the Field constructor. If the value is being set via api call then it would be called after ComponentDidMount so the init would already be called. As I understand it, Field cannot support react-hooks at the moment.
@jdkahn just want to save values, ant init may be not called at first render
render() {
this.field.getValues(); // should be {a:1} but actually get {}
return <div>
{this.state.show ? <input {...init('a')} />: null} // while show=true init(a) will be called
</div>
}
I cannot see a reasonable case where setValues is called before init (see my above comment). For it to work with parseName it would have to just store the entire object passed in a new field attribute, which I feel is adding unnecessary complexity if we don't have a clear use case.
If calling getValues before inputs are first rendered, then values could be assigned on Field construction. As of now, we iterate through field names, which will return nothing. This is an easy fix to return initValue as default value.
Version
Component
Field
Environment
all
Steps to reproduce
The text was updated successfully, but these errors were encountered: