score:1

add componentwillreceiveprops() and call the query there. it will run whenever the component receives new props. if you need to re-run the render function with the results of the query, you may need to call forceupdate();

componentwillreceiveprops(nextprops) {
       const localthis = this;  
       this.client.query({
            query: my_query,
            variables: {myvar: thevar},
        }).then((result) => {
            localthis.setstate({mystatevar: result.data.relevantdata});
            localthis.forceupdate();
        });
  }

Related Query

More Query from same tag