Relative Content

Tag Archive for javascriptreactjsapireduxredux-toolkit

RTK Query hooks can be called conditionaly in React Component?

I’m using RTK Query and It was required in the appplication to call certain query conditionally, so I did it by using if/else conditions and called the query hooks inside if/else blocks instead of using skip prop, and amzaingly it worked absolutely fine, react didn’t throw any error, not even warning. Why? We know that React strictly tells to use hooks at top in the component and not call them conditionally.