New to React here,
I'm building a class component with Typescript. I need to fetch data from the server when component displays. componentDidMount()
seems to be the right place to do that; but it is always called twice.
I found its because of the <React.StrictMode>
in my index.tsx (and should'nt be called twice in prod mode).
But in the meantime I feel pretty annoying that my api is called twice everytime while I'm developing my app.
Any way I can avoid that?
Thanks