mozzius
How to call useQuery with params inside JSX
Also - you’ve written a function checkIsOwner. You can call hooks inside functions you write, but you must then treat that function like a hook. In your case, you’d want to rename it to useHousingAssocIsOwner(assocId, userId) and then move it to the top level of a component
6 replies
How to call useQuery with params inside JSX
Basically, you can’t call a hook inside a loop (because react then can’t tell which one is which). So you need to move the logic to the top level of a component, and from the look of your code you should just pass userId to <BoardCard> and have it check isOwner inside there
6 replies
How to call useQuery with params inside JSX
You’re not following the rules of hooks! https://legacy.reactjs.org/docs/hooks-rules.html
6 replies