Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: format code with Prettier #28

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading