Git Product home page Git Product logo

Comments (8)

kokjinsam avatar kokjinsam commented on July 21, 2024 3

That's ok! I'm gonna leave a note here for future reference. In order to use Apollo Client with this package, we need to specifically tell Apollo Client to use the store created in react-redux-chrome.

For example, in your Root component:

class Root extends Component {
  render() {
    const {
      store,  //  this is the store created by `react-chrome-redux`
      client, // normal Apollo client
    } = this.props;
    
    client.setStore(store); // this is a private method in Apollo client. Be sure to always check this.

    return (
      <ApolloProvider store={store} client={client}>
        <App />
      </ApolloProvider>
    );
  }
}

from webext-redux.

kokjinsam avatar kokjinsam commented on July 21, 2024 1

@vhmth oops, definitely a typo! thanks for editing!

from webext-redux.

kokjinsam avatar kokjinsam commented on July 21, 2024

This issue is not related to react-chrome-redux but 'react-apollo`.

from webext-redux.

tshaddix avatar tshaddix commented on July 21, 2024

@sammkj Good to hear you figured it out! Sorry for the late reply!

from webext-redux.

tshaddix avatar tshaddix commented on July 21, 2024

Great! Thanks @sammkj

from webext-redux.

vhmth avatar vhmth commented on July 21, 2024

Dope thanks for providing a solution @sammkj - super super useful. I updated the code snippet to say client={client} instead of client-{client} - let me know if that wasn't a typo.

💯

from webext-redux.

mironov avatar mironov commented on July 21, 2024

@sammkj Thank you for the solution!
Am I right that Apollo Client will fetch queries on webpages instead of background page?

from webext-redux.

kokjinsam avatar kokjinsam commented on July 21, 2024

@mironov Glad that helped!

Yeap, that's correct if you're using react-apollo.

from webext-redux.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.