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

feat(conform-react): capture list item error #71

Merged
merged 2 commits into from
Jan 3, 2023
Merged

Conversation

edmundhung
Copy link
Owner

This PR adds error capturing logic for each list item, which is useful when dealing with simple array structure like string[]

function Example() {
  const [list, command] = useFieldList(form.ref, items.config);

  return (
    <ol>
      {list.map(item => (
        <li key={item.key}>
          <input {...conform.input(item.config)} />
          {item.error}
        </li>
      )}
    </ol>
  );
}

@codesandbox
Copy link

codesandbox bot commented Jan 2, 2023

CodeSandbox logoCodeSandbox logo  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@cloudflare-pages
Copy link

cloudflare-pages bot commented Jan 3, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6417920
Status: ✅  Deploy successful!
Preview URL: https://1c5864e9.conform.pages.dev
Branch Preview URL: https://simple-list.conform.pages.dev

View logs

@edmundhung edmundhung merged commit 1823ad0 into dev Jan 3, 2023
@edmundhung edmundhung deleted the simple-list branch January 3, 2023 21:29
@edmundhung edmundhung mentioned this pull request Jan 4, 2023
17 tasks
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.

None yet

1 participant