Skip to content

Commit

Permalink
Merge pull request #28 from react18-tools/deepsource-transform-675d367a
Browse files Browse the repository at this point in the history
style: format code with Prettier
  • Loading branch information
mayank1513 committed Jun 17, 2024
2 parents f6ecb5e + 6709ffa commit 2b56f96
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
42 changes: 21 additions & 21 deletions md-docs/1.getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ In some cases you might want to initialize the state with a function, for exampl

```tsx
const [state, setState] = useRGS<number>("counter", () =>
typeof localStorage === "undefined" ? 1 : localStorage.getItem("counter") ?? 1,
typeof localStorage === "undefined" ? 1 : localStorage.getItem("counter") ?? 1,
);
```

Expand All @@ -59,13 +59,13 @@ import useRGS from "r18gs";
import { COUNTER } from "../constants/global-states";

export default function Display() {
const [count] = useRGS<number>(COUNTER);
return (
<div>
<h2>Client Component 2</h2>
<b>{count}</b>
</div>
);
const [count] = useRGS<number>(COUNTER);
return (
<div>
<h2>Client Component 2</h2>
<b>{count}</b>
</div>
);
}
```

Expand All @@ -77,18 +77,18 @@ import useRGS from "r18gs";
import { COUNTER } from "../constants/global-states";

export default function Counter() {
const [count, setCount] = useRGS(COUNTER, 0);
return (
<div>
<h2>Client Component 1</h2>
<input
onChange={e => {
setCount(parseInt(e.target.value.trim()));
}}
type="number"
value={count}
/>
</div>
);
const [count, setCount] = useRGS(COUNTER, 0);
return (
<div>
<h2>Client Component 1</h2>
<input
onChange={e => {
setCount(parseInt(e.target.value.trim()));
}}
type="number"
value={count}
/>
</div>
);
}
```
18 changes: 9 additions & 9 deletions md-docs/2.leveraging-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ This function is beneficial if your requirements dictate that your `key` and/or
import { useRGSWithPlugins } from "r18gs/dist/with-plugin";

export function MyComponent(props: MyComponentProps) {
const [state, setState] = useRGSWithPlugins(
props.key,
props.initialVal,
props.plugins,
props.doNotInit,
);
// ...
const [state, setState] = useRGSWithPlugins(
props.key,
props.initialVal,
props.plugins,
props.doNotInit,
);
// ...
}
```

Expand All @@ -56,8 +56,8 @@ export const useMyRGS = withPlugins([plugin1, plugin2, ...]);

```tsx
export function MyComponent(props: MyComponentProps) {
const [state, setState] = useMyRGS(props.key, props.initialVal, props.doNotInit);
// ...
const [state, setState] = useMyRGS(props.key, props.initialVal, props.doNotInit);
// ...
}
```

Expand Down

0 comments on commit 2b56f96

Please sign in to comment.