How to store the data in React state after Querying it from GraphQL?Why do we need middleware for async flow in Redux?How to update the Redux store after Apollo GraphQL query returnsApollo GraphQL variable QueryApollo For GraphQL Does Not Return Required DataReact GraphQL Apollo and Redux. How to query data and place it in initialState of the store?Apollo GraphQL (React) Data sharing across componentsReact - Apollo Client, How to add query results to the statelifecycle react , redux, and redux-form apollo-graphqlCan't Filter GraphQL query with Apollo and display database data objectUsing Apollo Client Query to fetch data from an asynchronous library

Understanding "Current Draw" in terms of "Ohm's Law"

Ability To Change Root User Password (Vulnerability?)

Fermat's statement about the ancients: How serious was he?

What is the logic behind taxing money for property?

Origin of "boor"

Why can my keyboard only digest 6 keypresses at a time?

How to communicate to my GM that not being allowed to use stealth isn't fun for me?

Neat redistribution of association values

Is it possible to have 2 different but equal size real number sets that have the same mean and standard deviation?

Why not invest in precious metals?

What are neighboring ports?

Is there a set of positive integers of density 1 which contains no infinite arithmetic progression?

How can I remove material from this wood beam?

With Ubuntu 18.04, how can I have a hot corner that locks the computer?

How to safely destroy (a large quantity of) valid checks?

What standard algorithm can determine if exactly one of a container satisfies a predicate?

Can a human be transformed into a Mind Flayer?

UTC timestamp format for launch vehicles

What is the color of artificial intelligence?

How to learn Linux system internals

60s or 70s novel about Empire of Man making 1st contact with 1st discovered alien race

How to hide rifle during medieval town entrance inspection?

Which is the better way to call a method that is only available to one class that implements an interface but not the other one?

Draw a line with an isolated and accumulation point in mathbbR



How to store the data in React state after Querying it from GraphQL?


Why do we need middleware for async flow in Redux?How to update the Redux store after Apollo GraphQL query returnsApollo GraphQL variable QueryApollo For GraphQL Does Not Return Required DataReact GraphQL Apollo and Redux. How to query data and place it in initialState of the store?Apollo GraphQL (React) Data sharing across componentsReact - Apollo Client, How to add query results to the statelifecycle react , redux, and redux-form apollo-graphqlCan't Filter GraphQL query with Apollo and display database data objectUsing Apollo Client Query to fetch data from an asynchronous library






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















Following is my Query:



import React from 'react';
import getProducts from '../queries/getProduct';
import Query from "react-apollo";


export const Product = () =>
const proId =
"productId": "95eb601f2d13"


return (
<Query query=getProducts variables=proId>
( loading, error, data ) =>
if (loading) return "Loading...";
if (error) return `Error! $error.message`;

return (
<div>
data.map(entry => entry)
</div>
);

</Query>
);
;

export default Product;


I need to now store the received data in React or Redux (whichever is ideal) so I can access that data in 1/2 Components. How can I store data rather than rendering it like it's doing above?



Depending on this data, I am rendering 90% components.










share|improve this question




























    0















    Following is my Query:



    import React from 'react';
    import getProducts from '../queries/getProduct';
    import Query from "react-apollo";


    export const Product = () =>
    const proId =
    "productId": "95eb601f2d13"


    return (
    <Query query=getProducts variables=proId>
    ( loading, error, data ) =>
    if (loading) return "Loading...";
    if (error) return `Error! $error.message`;

    return (
    <div>
    data.map(entry => entry)
    </div>
    );

    </Query>
    );
    ;

    export default Product;


    I need to now store the received data in React or Redux (whichever is ideal) so I can access that data in 1/2 Components. How can I store data rather than rendering it like it's doing above?



    Depending on this data, I am rendering 90% components.










    share|improve this question
























      0












      0








      0








      Following is my Query:



      import React from 'react';
      import getProducts from '../queries/getProduct';
      import Query from "react-apollo";


      export const Product = () =>
      const proId =
      "productId": "95eb601f2d13"


      return (
      <Query query=getProducts variables=proId>
      ( loading, error, data ) =>
      if (loading) return "Loading...";
      if (error) return `Error! $error.message`;

      return (
      <div>
      data.map(entry => entry)
      </div>
      );

      </Query>
      );
      ;

      export default Product;


      I need to now store the received data in React or Redux (whichever is ideal) so I can access that data in 1/2 Components. How can I store data rather than rendering it like it's doing above?



      Depending on this data, I am rendering 90% components.










      share|improve this question














      Following is my Query:



      import React from 'react';
      import getProducts from '../queries/getProduct';
      import Query from "react-apollo";


      export const Product = () =>
      const proId =
      "productId": "95eb601f2d13"


      return (
      <Query query=getProducts variables=proId>
      ( loading, error, data ) =>
      if (loading) return "Loading...";
      if (error) return `Error! $error.message`;

      return (
      <div>
      data.map(entry => entry)
      </div>
      );

      </Query>
      );
      ;

      export default Product;


      I need to now store the received data in React or Redux (whichever is ideal) so I can access that data in 1/2 Components. How can I store data rather than rendering it like it's doing above?



      Depending on this data, I am rendering 90% components.







      reactjs redux react-apollo apollo-client graphql-js






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 24 at 19:53









      Ishan PatelIshan Patel

      8091831




      8091831






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Try onCompleted like so:



          function onCompletedHandler(data) 
          dispatch( 'RECEIVED_DATA': data )


          <Query query=getProducts variables=proId onCompleted=onCompletedHandler>
          ...
          </Query>





          share|improve this answer

























          • Thank you @Hrayr

            – Ishan Patel
            Mar 24 at 21:13











          • I also advise you to have a look at Local state management of Apollo Client. apollographql.com/docs/react/essentials/local-state.html

            – Hrayr Movsisyan
            Mar 25 at 8:37











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55327935%2fhow-to-store-the-data-in-react-state-after-querying-it-from-graphql%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Try onCompleted like so:



          function onCompletedHandler(data) 
          dispatch( 'RECEIVED_DATA': data )


          <Query query=getProducts variables=proId onCompleted=onCompletedHandler>
          ...
          </Query>





          share|improve this answer

























          • Thank you @Hrayr

            – Ishan Patel
            Mar 24 at 21:13











          • I also advise you to have a look at Local state management of Apollo Client. apollographql.com/docs/react/essentials/local-state.html

            – Hrayr Movsisyan
            Mar 25 at 8:37















          1














          Try onCompleted like so:



          function onCompletedHandler(data) 
          dispatch( 'RECEIVED_DATA': data )


          <Query query=getProducts variables=proId onCompleted=onCompletedHandler>
          ...
          </Query>





          share|improve this answer

























          • Thank you @Hrayr

            – Ishan Patel
            Mar 24 at 21:13











          • I also advise you to have a look at Local state management of Apollo Client. apollographql.com/docs/react/essentials/local-state.html

            – Hrayr Movsisyan
            Mar 25 at 8:37













          1












          1








          1







          Try onCompleted like so:



          function onCompletedHandler(data) 
          dispatch( 'RECEIVED_DATA': data )


          <Query query=getProducts variables=proId onCompleted=onCompletedHandler>
          ...
          </Query>





          share|improve this answer















          Try onCompleted like so:



          function onCompletedHandler(data) 
          dispatch( 'RECEIVED_DATA': data )


          <Query query=getProducts variables=proId onCompleted=onCompletedHandler>
          ...
          </Query>






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 24 at 20:46

























          answered Mar 24 at 20:22









          Hrayr MovsisyanHrayr Movsisyan

          2613




          2613












          • Thank you @Hrayr

            – Ishan Patel
            Mar 24 at 21:13











          • I also advise you to have a look at Local state management of Apollo Client. apollographql.com/docs/react/essentials/local-state.html

            – Hrayr Movsisyan
            Mar 25 at 8:37

















          • Thank you @Hrayr

            – Ishan Patel
            Mar 24 at 21:13











          • I also advise you to have a look at Local state management of Apollo Client. apollographql.com/docs/react/essentials/local-state.html

            – Hrayr Movsisyan
            Mar 25 at 8:37
















          Thank you @Hrayr

          – Ishan Patel
          Mar 24 at 21:13





          Thank you @Hrayr

          – Ishan Patel
          Mar 24 at 21:13













          I also advise you to have a look at Local state management of Apollo Client. apollographql.com/docs/react/essentials/local-state.html

          – Hrayr Movsisyan
          Mar 25 at 8:37





          I also advise you to have a look at Local state management of Apollo Client. apollographql.com/docs/react/essentials/local-state.html

          – Hrayr Movsisyan
          Mar 25 at 8:37



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55327935%2fhow-to-store-the-data-in-react-state-after-querying-it-from-graphql%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

          밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

          1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴