How to use the urql.useQuery function in urql

To help you get started, we’ve selected a few urql examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FormidableLabs / urql / examples / 3-ssr-with-nextjs / components / PostList.js View on Github external
export default function PostList() {
  const [allPostsResult] = useQuery({
    query: allPostsQuery,
    variables: allPostsQueryVars,
  });

  if (allPostsResult.error) {
    return ;
  } else if (allPostsResult.loading || !allPostsResult.data) {
    return <div>Loading</div>;
  }

  const { allPosts, _allPostsMeta } = allPostsResult.data;

  return (
    <section>
      <ul>
        {allPosts.map((post, index) =&gt; (</ul></section>
github carlos-kelly / publications / src / contexts / documents-provider.tsx View on Github external
export default function DocumentsProvider(props: Props) {
  const [
    { data: currentUserData, fetching: userFetching },
    refetchCurrentUser,
  ] = useQuery({
    query: currentUserQuery,
    requestPolicy: "network-only",
  });
  const [{ data: docsData }, refreshDocsData] = useQuery({
    query: documentsQuery,
    requestPolicy: "network-only",
  });
  const [, saveDocumentAction] = useMutation&lt;
    SaveDocumentMutationResponse,
    SaveDocumentMutation
  &gt;(saveDocumentMutation);
  const [, deleteDocumentAction] = useMutation&lt;
    DeleteDocumentMutationResponse,
    DeleteDocumentMutation
  &gt;(deleteDocumentMutation);
  const [, login] = useMutation(

urql

A highly customizable and versatile GraphQL client for React

MIT
Latest version published 2 months ago

Package Health Score

98 / 100
Full package analysis