Why shouldn’t data fetching occur in constructors or render methods?

Junior React

Answer

Fetching causes side effects. Render and constructors must remain pure, so fetching should occur in effects or server loaders.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice