How to use the urql.query 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 babel-blade / babel-blade / packages / babel-plugin-blade / src / __tests__ / fixtures / fragment.js View on Github external
const App = () => (
   {
      let result = pageQuery(data)
      // rendering Movie while adding
      // `Movie.fragment` into the query.
      // (could be automatic in future)
      return (
        <ul>
          
        </ul>
      )
    }}
  /&gt;
)
github therehq / there-desktop / renderer / components / Toolbar.js View on Github external
placesIds: places && places.map(p => p.id),
    }

    await sortFollowings(followingsOrder)

    // Sort has been persisted on the server,
    // Let's exit sort mode when the new followings
    // fetched
    console.log('disabling sort mode....')
    sortMode.disableOnFollowingsFetched()
  }
}

export default Toolbar

const User = query(gql`
  query {
    user {
      id
      displayFormat
      email
      firstName
      timezone
      city
    }
  }
`)

const SortFollowings = mutation(gql`
  mutation($peopleIds: [ID!], $placesIds: [ID!]) {
    sortFollowings(peopleIds: $peopleIds, placesIds: $placesIds) {
      people {
github therehq / there-desktop / renderer / components / DetectTimezone.js View on Github external
export default ConnectHOC(() => {
  // Get user preference
  const shouldUpdate = getTimeZoneAutoUpdate()

  return {
    cache: false,
    query: shouldUpdate ? query(User) : undefined,
    mutation: {
      updateTimezone: mutation(UpdateTimezone),
    },
  }
})(DetectTimezone)
github babel-blade / babel-blade / packages / babel-plugin-blade / src / __tests__ / fixtures / basic.js View on Github external
const Movie = ({id, onClose}) =&gt; (
  <div>
     {
        const DATA = movieQuery(data)
        return (
          <div>
            <h2>{DATA.movie.gorilla}</h2>
            <p>{DATA.movie.monkey}</p>
            <p>{DATA.chimp}</p>
          </div>
        )
      }}
    /&gt;
  </div>
)
github michaelwilcox / headfon.es / client / src / pages / Artist / index.tsx View on Github external
public componentDidMount() {
    const { client, id } = this.props;

    client.executeQuery(query(ArtistQuery, { id }), true).then((res: any) => {
      setArtistViewing(res.data.artist);
    });

    client
      .executeQuery(query(ArtistBioQuery, { id }), true)
      .then((res: any) => {
        console.log('artist bio', res);
      });
  }
  public render() {
github michaelwilcox / headfon.es / client / src / pages / Artist / index.tsx View on Github external
public componentDidMount() {
    const { client, id } = this.props;

    client.executeQuery(query(ArtistQuery, { id }), true).then((res: any) => {
      setArtistViewing(res.data.artist);
    });

    client
      .executeQuery(query(ArtistBioQuery, { id }), true)
      .then((res: any) => {
        console.log('artist bio', res);
      });
  }
  public render() {
github GraphCMS / graphcms-examples / legacy / react-urql-blog / src / components / Post.js View on Github external
const Post = ({match}) =&gt; (
   {
      if (error) return <div>Error!</div>
      if (!loaded) return <div>Loading post...</div>

      return (
        <article>
          <h1>{data.post.title}</h1>
          <div>
            <img src="{`https://media.graphcms.com/resize=w:650,h:366,fit:crop/${data.post.coverImage.handle}`}" alt="{data.post.title}">
          </div>
          </article>
github michaelwilcox / headfon.es / client / src / components / search / Results / index.tsx View on Github external
    (query) => client.executeQuery(urqlQuery(SearchResultsQuery, { query }), true)
);
github therehq / there-desktop / renderer / components / tray / Followings.js View on Github external
setDisplayFormat(newFormat)
    this.forceUpdate()
  }

  openChat = () => {
    const { data } = this.props

    if (!this.ipc) {
      return
    }

    this.ipc.send('open-chat', data && data.user)
  }
}

const FollowingList = query(gql`
  query {
    followingList {
      people {
        ...Person
      }
      places {
        ...Place
      }
    }
    pinnedList {
      ...Following
    }
    user {
      id
      city
      timezone
github therehq / there-desktop / renderer / components / edit / Place / Place.js View on Github external
export default ConnectHOC(({ objectId }) => ({
  query: query(GetPlace, { id: objectId }),
  mutation: {
    updatePlace: UpdatePlace,
  },
  cache: false,
}))(PlacePage)

urql

A highly customizable and versatile GraphQL client for React

MIT
Latest version published 8 days ago

Package Health Score

98 / 100
Full package analysis