Skip to content

Commit

Permalink
docs: refactored examples that use the logical ! (#2602)
Browse files Browse the repository at this point in the history
Co-authored-by: Jovi De Croock <decroockjovi@gmail.com>
  • Loading branch information
MoustaphaDev and JoviDeCroock authored Aug 19, 2022
1 parent e79b8ab commit fec1ff4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion docs/basics/react-preact.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,12 @@ executed. We can do this by setting the `pause` option to `true`:

```jsx
const Todos = ({ from, limit }) => {
const shouldPause = from === undefined || from === null ||
limit === undefined || limit === null;
const [result, reexecuteQuery] = useQuery({
query: TodosListQuery,
variables: { from, limit },
pause: !from || !limit,
pause: shouldPause,
});

// ...
Expand Down
3 changes: 2 additions & 1 deletion docs/basics/vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ import { useQuery } from '@urql/vue';
export default {
props: ['from', 'limit'],
setup({ from, limit }) {
const shouldPause = computed(() => from == null || limit == null);
return useQuery({
query: `
query ($from: Int!, $limit: Int!) {
Expand All @@ -279,7 +280,7 @@ export default {
}
`,
variables: { from, limit },
pause: computed(() => !from.value || !limit.value)
pause: shouldPause
});
}
};
Expand Down

0 comments on commit fec1ff4

Please sign in to comment.