Skip to content

Commit

Permalink
main 🧊 fix locale storage, add api for use mutate
Browse files Browse the repository at this point in the history
  • Loading branch information
debabin committed Jul 14, 2024
1 parent db432aa commit a53eaf2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/hooks/useAsync/useAsync.demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ const getPokemon = (id: number) =>

const Demo = () => {
const counter = useCounter(1);
const getPokemonQuery = useAsync(() => getPokemon(counter.value), [counter.value]});
const getPokemonQuery = useAsync(() => getPokemon(counter.value), [counter.value]);

return (
<>
<button type='button' disabled={counter.count === 1} onClick={() => counter.dec()}>
<button type='button' disabled={counter.value === 1} onClick={() => counter.dec()}>
Prev
</button>
<button type='button' onClick={() => counter.inc()}>
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useClickOutside/useClickOutside.demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ const Demo = () => {
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
border: `1px solid ${counter.count < 5 ? 'red' : 'green'}`
border: `1px solid ${counter.value < 5 ? 'red' : 'green'}`
}}
>
<p>Click more than 5 times:</p>
<p>
<code>{counter.count}</code>
<code>{counter.value}</code>
</p>
</div>
);
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/usePageLeave/usePageLeave.demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import { useCounter } from '../useCounter/useCounter';
import { usePageLeave } from './usePageLeave';

const Demo = () => {
const { count, inc } = useCounter(0);
const counter = useCounter(0);

const isLeft = usePageLeave(() => inc());
const isLeft = usePageLeave(() => counter.inc());

return (
<>
<p>
Mouse left the page: <code>{String(isLeft)}</code>
</p>
<p>Count of left the page {count} times</p>
<p>Count of left the page {counter.value} times</p>
</>
);
};
Expand Down

0 comments on commit a53eaf2

Please sign in to comment.