-2

So we're newly introduced to redux in our course and i'm using graphCMS so we can create products and fetch that data by queries. But, when we got introduced to redux and access the data more easily instead of passing props all over, it doesn't work with calling queries. Been trying different things today by myself and trying to google, but i can't really find any solution. Here's my code right now, code

And this code will produce: output , so the empty array is when i refresh/run the program and when i click "Get Data" i just get "$$typeof: Symbol(react.element), key: null, ref: null, props: {…}, type: ƒ, …}" so it does happen something.. but no data in it as expected from graphCMS.

I've realized that it doesn't even reach the code inside at all (by trying to run console.log("string") for example).

Here's my app.js which calls the console.log from the state. app.js

Any ideas how i can get this out as the objects i want, is it possible? This does work otherwise, but not in redux/reducer.

Best regards, newbie

Linus
  • 1
  • redux and data fetching: https://stackoverflow.com/questions/34570758/why-do-we-need-middleware-for-async-flow-in-redux?rq=1 ... but nowadays there is **no need to duplicate data fetched by Apollo (normalizing cache) into redux store** ... `` component must be rendered (not a normal function, can't be called in reducer or any other place) and is deprecated (old tutorials? use `useQuery`) ... use redux for app global state, apollo hooks for data fetching ... follow some better tutorials – xadm May 04 '21 at 22:36

0 Answers0