Skip to content

Do I need a special import to use custom hooks in React ? #316

Closed Answered by olavoparno
coopterrones asked this question in Q&A
Discussion options

You must be logged in to vote

This is a hook rule being broken, you see, in order to use hooks or custom hooks you must follow the rules of:

  • either calling it from a react function component e.g. function MyReactComponent() or calling from a custom hook preappended with the word use, so you would have to have your queryCompetitions renamed to useQueryCompetitions.

https://reactjs.org/docs/hooks-rules.html

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@coopterrones
Comment options

Answer selected by coopterrones
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants