DEV Community

Discussion on: React's Odd Obsession With Declarative Syntax

Collapse
 
bytebodger profile image
Adam Nathaniel Davis

I suppose "wrong tool" is a matter of opinion. In the React core docs, they specifically call out componentDidMount as the place where you should populate data calls:

reactjs.org/docs/faq-ajax.html

To be fair, there are other things in the React docs that I don't particularly agree with. So I'm not blindly pointing to their recommendation as the unquestionable "final answer". But it's kinda difficult to label componentDidMount as the "wrong tool" when it's the exact tool named for the task in their own docs.

As for your broader point about memoization - it's a good one. I know what memoization is. But I might be able to make more practical use of it with regard to API calls. I'll have a look at your GitHub code. Thanks for the link!