Files
apollo/docs/guide/local-state.md
T
Natalia Tepluhina 2759825251 docs: Vuepress-powered docs (#296)
* * created vuepress docs

* chore: upgrade deps

* docs: patreon link

* Docs changes
2018-06-18 15:38:46 +02:00

680 B

Local state

If you need to manage local data, you can do so with apollo-link-state and the @client directive:

export default {
  apollo: {
    hello: gql`
      query {
        hello @client {
          msg
        }
      }
    `
  },
  mounted() {
    // mutate the hello message
    this.$apollo
      .mutate({
        mutation: gql`
          mutation($msg: String!) {
            updateHello(message: $msg) @client
          }
        `,
        variables: {
          msg: 'hello from link-state!'
        }
      })
  }
}

Example project (thx @chriswingler)