Hi @palanisamyc, could you share some of the surrounding code?
As the error message suggests, you can only call a hook (with useStreamQuery
being one such hook) in the body of a function component. It’s not entirely clear where you are calling it from based on the screenshot but it looks like it might be from the top-level of the file outside of a function component. I recommend reading the introduction to react hooks to get an idea for how you can use hooks inside of a function component.
The other possibility is that the code you’ve shown us is in the body of a class component. You cannot use hooks there directly but there are various options to combine them. A quick search brought up this blogpost which shows two easy options.