#Api Triggering
I have seen that same api calls are triggering two times why this was happening.This will effects the performance right
4 Replies
like-gold•2y ago
This is probably occurs with
<React.StrictMode>
This is the expected behavior because <React.StrictMode>
renders that component twice. When you remove <React.StrictMode>
you will see the request only triggering once.
I suggest you should not remove <React.StrictMode>
It only works on dev
mode.conscious-sapphireOP•2y ago
Whats the solution for that
like-gold•2y ago
you can read this
https://refine.dev/blog/react-strict-mode-in-react-18/
https://reactjs.org/docs/strict-mode.html
but long story short, if you remove <React.StrictMode> on index.ts it will trigger once.
but i strongly recommend do not remove <React.StrictMode>. it will not trigger twice on production because strict mode not work on production.
actually, this is not a bug. it's a feature to hunt bugs
conscious-sapphireOP•2y ago
Thanks 🙏