Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using GraphQl inside the Filter Component #4

Open
fadeomar opened this issue Nov 26, 2019 · 0 comments
Open

Using GraphQl inside the Filter Component #4

fadeomar opened this issue Nov 26, 2019 · 0 comments
Assignees
Labels

Comments

@fadeomar
Copy link
Collaborator

  • 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
@MohammadAlhalaq MohammadAlhalaq self-assigned this Nov 27, 2019
MohammadAlhalaq added a commit that referenced this issue Nov 28, 2019
MohammadAlhalaq added a commit that referenced this issue Nov 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants