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
{{ message }}
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.
This fork of the project has a Form component definition that doesn't match upstream. While there's a fair bit of divergence by virtue of targeting JSX 3, the definition in this fork doesn't appear to be all that usable. In particular, Ant expects you to call a create function to wrap its Form element, giving you something with FormComponentProps, which is needed to validate and extract form values. Basically, it's needed to work with Ant's version of controlled form components. That function is not imported here, so the Form component can't be wrapped.
The text was updated successfully, but these errors were encountered:
This issue is trickier than I thought. Apparently Ant needs the Form wrapper to be a class-based component, which is not what [@react.component] will give you. I came across an article on the changes needed to make the wrapper with functional components.
In the meanwhile, I've discovered that you can use controlled components in Ant's form subsystem just like you would with vanilla React. It's not ideal because you give up all the validation helpers, but it does make it possible to use Ant's styles and rich components.
Hey, i totally agree that form component is not quite usable at the moment. At the moment i'm updating bindings only when i need specific stuff at work. As mentioned in #4 i'm planning on doing better bindings when 4.0.0 goes public. Ant team wants to simplify Form component and introduce hooks-like approach instead of Form.create hoc. Example from ant github:
constDemo=()=>{const[form]=Form.useForm();constonFinish=()=>{// Do something...};useEffect(()=>{// Something like ajax callform.setFieldsValue({username: 'light',});},[]);return(<Formform={form}onFinish={onFinish}><Form.Itemname="username"rules={[{required: true}]}><Input/></Form.Item></Form>);}
This fork of the project has a
Form
component definition that doesn't match upstream. While there's a fair bit of divergence by virtue of targeting JSX 3, the definition in this fork doesn't appear to be all that usable. In particular, Ant expects you to call acreate
function to wrap itsForm
element, giving you something withFormComponentProps
, which is needed to validate and extract form values. Basically, it's needed to work with Ant's version of controlled form components. That function is not imported here, so theForm
component can't be wrapped.The text was updated successfully, but these errors were encountered: