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

WIP Field groups implementation #236

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

andyrichardson
Copy link
Owner

@andyrichardson andyrichardson commented Jun 19, 2020

About

Fix #219

Notes

Adds middleware for translating group logic into a flat structure that fielder can understand.

// Inside a Fielder context
const GroupExample = () => {
  const group = useFieldGroup();

  return (
    <FieldGroupProvider value={group}>
      <Child />
      <Child />
      <Child />
    </FieldGroupProvider>
  );
}

const Child = () => {
  const [fieldProps, fieldMeta] = useField({ name: '1234' }) // Same API

  //...
}

Todo

  • Add group validation function which executes validation argument to useFieldGroup and also throws errors if any errors exist in the field group state (blocked by Changes to validation arg doesn't update validation function #235).
  • Update mountField fns in all contexts to return name of field
  • Add useFieldGroupContext() || useFormContext() logic to useField
  • Add example
  • Add documentation

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

Successfully merging this pull request may close these issues.

Add support for form collections
1 participant