@bigbinary/neeto-form-frontend 1.0.21 → 1.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -0
- package/dist/index.cjs.js +504 -354
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +500 -355
- package/dist/index.js.map +1 -1
- package/dist/main.css +1 -1
- package/index.d.ts +41 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -156,6 +156,46 @@ const Component = () => {
|
|
|
156
156
|
};
|
|
157
157
|
```
|
|
158
158
|
|
|
159
|
+
`useForms` hook is used to fetch all the forms.
|
|
160
|
+
|
|
161
|
+
`useForm` hook is used to fetch all details of a form.
|
|
162
|
+
|
|
163
|
+
`useCreateForm` hooks is used to create a form.
|
|
164
|
+
|
|
165
|
+
`useUpdateForm` hooks is used to update a form.
|
|
166
|
+
|
|
167
|
+
`useDeleteForm` hooks is used to delete a form.
|
|
168
|
+
|
|
169
|
+
The usage is as follows.
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
```js
|
|
173
|
+
import { useForm, useForm, useCreateForm, useUpdateForm, useDeleteForm } from "@bigbinary/neeto-form-frontend";
|
|
174
|
+
|
|
175
|
+
const Component = () => {
|
|
176
|
+
const { data: forms, isLoading } = useForms();
|
|
177
|
+
const { data: form, isLoading } = useForm({formId: "form-id"});
|
|
178
|
+
|
|
179
|
+
const { mutate: createForm, isLoading } = useCreateForm();
|
|
180
|
+
createForm(payload);
|
|
181
|
+
|
|
182
|
+
const { mutate: updateForm, isLoading } = useUpdateForm();
|
|
183
|
+
updateForm({id: "form-id", values: payload});
|
|
184
|
+
|
|
185
|
+
const { mutate: deleteForm, isLoading } = useDeleteForm();
|
|
186
|
+
deleteForm("form-id");
|
|
187
|
+
|
|
188
|
+
return <></>;
|
|
189
|
+
};
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
*`useCreate`, `useUpdate` & `useDelete` uses react-query's useMutation hook under the hood.*
|
|
193
|
+
|
|
194
|
+
*`useForm` & `useForms` uses react-query's useQuery hook under the hood.*
|
|
195
|
+
|
|
196
|
+
*We can pass in extra options supported by react-query to these hooks.
|
|
197
|
+
We can also destructure all react-query supported props from the response.*
|
|
198
|
+
|
|
159
199
|
## Development
|
|
160
200
|
|
|
161
201
|
Install all the dependencies by executing the following command
|