Skip to content

Commit c12178e

Browse files
authored
Merge pull request #543 from NMFS-RADFish/542-polish-on-device-storage
542 - Polish on device storage
2 parents eab0c41 + 0c05be9 commit c12178e

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

examples/on-device-storage/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ Learn more about RADFish examples at the official [documentation](https://nmfs-r
1111

1212
## Steps
1313

14-
1. In the `index.jsx` file, import the `OfflineStorageWrapper`, then create a configuration object:
14+
### 1. Configure Offline Storage
15+
In the `index.jsx` file, import the `OfflineStorageWrapper`, then create a configuration object:
1516

1617
```jsx
1718
import { OfflineStorageWrapper } from "@nmfs-radfish/react-radfish";
@@ -33,7 +34,8 @@ const offlineStorageConfig = {
3334
};
3435
```
3536

36-
2. In the `index.jsx` file, wrap the `App` component with `OfflineStorageWrapper` and pass the config object:
37+
### 2. Wrap the App Component
38+
In the `index.jsx` file, wrap the `App` component with `OfflineStorageWrapper` and pass the config object:
3739

3840
```jsx
3941
const root = ReactDOM.createRoot(document.getElementById("root"));
@@ -49,7 +51,7 @@ root.render(
4951

5052
## `useOfflineStorage` Hook API
5153

52-
1. Use the `useOfflineStorage` context hook in any child components. See the `App.jsx` file for examples of how to use the provided hooks.
54+
Use the `useOfflineStorage` context hook in any child components. See the `App.jsx` file for examples of how to use the provided hooks.
5355

5456
The `useOfflineStorage` hook returns an object with the following methods:
5557

examples/on-device-storage/src/pages/Home.jsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ const HomePage = () => {
4242
const updateData = async (e, data) => {
4343
e.preventDefault();
4444

45-
// const dataToUpdate = formData.find((data) => data.uuid === uuid);
4645
const updatedData = {
4746
...data,
4847
numberOfFish: Number((data.numberOfFish += 1)),
@@ -75,19 +74,19 @@ const HomePage = () => {
7574
<div className="grid-container">
7675
<h1>On Device Storage Example</h1>
7776
<Alert type="info" heading="Information" headingLevel="h2">
78-
This is an example of how to use the <code>OfflineStorageWrapper</code>{" "}
79-
context and the provided <code>useOfflineStorage</code> hook to interact
77+
This is an example of how to use the <strong>OfflineStorageWrapper</strong>{" "}
78+
context and the provided <strong>useOfflineStorage</strong> hook to interact
8079
with on-device storage. This example demonstrates how to create, read,
8180
update, and delete data from IndexedDB. The{" "}
82-
<code>useOfflineStorage</code> hooks uses Dexie.js under the hood.
81+
<strong>useOfflineStorage</strong> hooks uses Dexie.js under the hood.
8382
<br />
8483
<br />
8584
Please note that if you choose to test this example with the network
8685
connection offline, you won’t be able to refresh the page. To do this,
8786
you must ensure that Service Worker is registered, which requires the
8887
example to be served as a production build using{" "}
89-
<code>npm run build</code> and serving that output using a basic HTTP
90-
server such as <code>serve build</code>
88+
<strong>npm run build</strong> and serving that output using a basic HTTP
89+
server such as <strong>serve build</strong>.
9190
<br />
9291
<br />
9392
<Link

0 commit comments

Comments
 (0)