Files
apollo/docs/guide/local-state.md
T
Sara Vieira 3739a7c029 docs: Add Apollo boost (#313)
* Add Apollo boost

* Add example for apollo-link-state
2018-08-30 13:42:21 +02:00

747 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) Todo App (thx @NikkitaFTW)