GSG-G7/shrinc-v2

Using GraphQl inside the Filter Component

Opened this issue · 0 comments

  • remove the axios importance inside the component
    import axios from 'axios';

  • import the cities's query form the queries file
    import queryCities from '../query'

  • import the graphql from the react-apollo
    import {graphql} from 'react-apollo';

  • bind the query to the component so that you can access it from the props of component using graphql :
    export default graphql(queryCities)(Filter);

  • In the componentDidMount :

    • remove the axios things
    • call the query in set the data in the state of the component