Skip to content

Commit

Permalink
Added support for GET methods, increased test coverage to 95+ %
Browse files Browse the repository at this point in the history
  • Loading branch information
AlemTuzlak committed May 2, 2023
1 parent 616fad3 commit b754895
Show file tree
Hide file tree
Showing 6 changed files with 5,380 additions and 18 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ export default function MyForm() {

Now supports no-js form submissions!

If you made a GET request instead of a POST request and you are using this inside of a loader it will try to extract the data from the search params

If the form is submitted without js it will try to parse the formData object and covert it to the same format as the data object returned by `useRemixForm`. If the form is submitted with js it will automatically extract the data from the request object and validate it.

getValidatedFormData is a utility function that can be used to validate form data in your action. It takes two arguments: the request object and the resolver function. It returns an object with two properties: `errors` and `data`. If there are no errors, `errors` will be `undefined`. If there are errors, `errors` will be an object with the same shape as the `errors` object returned by `useRemixForm`. If there are no errors, `data` will be an object with the same shape as the `data` object returned by `useRemixForm`.
Expand Down Expand Up @@ -180,6 +182,10 @@ export const action = async ({ request }: ActionArgs) => {

```

## getFormDataFromSearchParams

If you're using a GET request formData is not available on the request so you can use this method to extract your formData from the search parameters assuming you set all your data in the search parameters

<hr />

## Hooks
Expand Down Expand Up @@ -299,9 +305,6 @@ const NestedInput = () => {
```



<hr />

## Support

If you like the project, please consider supporting us by giving a ⭐️ on Github.
Expand Down
Loading

0 comments on commit b754895

Please sign in to comment.