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
Copy file name to clipboardExpand all lines: examples/persisted-form/README.md
+11-6Lines changed: 11 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ This example shows you how to configure a persisted form that saves the data loc
6
6
7
7
The `FormWrapper` component is a context provider for form data. It provides a context that contains the current form data, a function to update the form data, and a function to handle form input changes.
8
8
9
-
Learn more about RADFish examples at the official [documentation](https://nmfs-radfish.github.io/radfish/developer-documentation/examples-and-templates#examples)
9
+
Learn more about RADFish examples at the official [documentation](https://nmfs-radfish.github.io/radfish/developer-documentation/examples-and-templates#examples).
10
10
11
11
### Imports
12
12
@@ -53,7 +53,8 @@ The `useFormState` hook is a custom hook for accessing the `FormContext`.
53
53
54
54
## Steps
55
55
56
-
1. In the `index.jsx` file, import the `OfflineStorageWrapper`, then create a configuration object:
56
+
### 1. Configure Offline Storage
57
+
In the `index.jsx` file, import the `OfflineStorageWrapper`, then create a configuration object:
3. Use the provided `FormWrapper` context provider in this example, located in the `/src/contexts/FormWrapper.jsx` directory, to wrap child form components in a parent component. In this example `App.jsx` is the parent component.
90
-
1. Create a `handleOnSubmit` handler and pass it to the wrapper:
91
+
### 3. Add FormWrapper Context Provider
92
+
Use the provided `FormWrapper` context provider in this example, located in the `/src/contexts/FormWrapper.jsx` directory, to wrap child form components in a parent component. In this example `App.jsx` is the parent component.
93
+
94
+
Create a `handleOnSubmit` handler and pass it to the wrapper:
91
95
92
96
```jsx
93
97
const { createOfflineData } =useOfflineStorage();
@@ -114,7 +118,8 @@ return (
114
118
);
115
119
```
116
120
117
-
4. Construct your form using the `react-radfish` components. See the `/src/pages/Form.jsx` file to see how to construct the form and use the methods available from `FormWrapper`.
121
+
### 4. Build the Form
122
+
Construct your form using the `react-radfish` components. See the `/src/pages/Form.jsx` file to see how to construct the form and use the methods available from `FormWrapper`.
118
123
119
124
## Preview
120
125
This example will render as shown in this screenshot:
0 commit comments