AhmedYahya24 / spzceX

0 stars 1 forks source link

Usage of Gql variables #11

Open NouraldinS opened 2 years ago

NouraldinS commented 2 years ago

Never supply variables to a graphql function by string literals, use the built in variable system, read https://github.com/AhmedYahya24/spzceX/blob/d753e7f6e31fa36501ca331d113bc0521a555a4d/space-x-graphql/src/utils/hooks/useQueryModal.js#L5-L10

So you don't need to call fetchDataModal like this: https://github.com/AhmedYahya24/spzceX/blob/d753e7f6e31fa36501ca331d113bc0521a555a4d/space-x-graphql/src/utils/hooks/useQueryModal.js#L49-L50

HamzAlaydi commented 2 years ago

I tried not call the "fetchDataModal(limit, offset, id) " like this but .. I cant import limit (which is redux attribute) inside the function this error will be presented when i use (useSelector) insid the function

Compiled with problems:X ERROR

src\utils\hooks\useReactQeury.js Line 6:21: React Hook "useSelector" is called in function "fetchDataLunches" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use" react-hooks/rules-of-hooks Search for the keywords to learn more about each error.

NouraldinS commented 2 years ago

@HamzAlaydi

image