Wordpressor
Wordpressor

Reputation: 7543

React - number of components and performance

I'm writing my first complex Redux/React SPA and I expect to end up with at least 500 components.

I was told that I should merge some components because the less components the faster the app will be (I guess that's the rendering issue?). On the other hand everywhere I go (like official docs) it says the components should be as small as possible.

Which approach is best?

Upvotes: 1

Views: 261

Answers (1)

Slawa Eremin
Slawa Eremin

Reputation: 5415

I think, you should read this article https://medium.com/dailyjs/react-is-slow-react-is-fast-optimizing-react-apps-in-practice-394176a11fba

The main steps for improving your application:
1) small reusable components
2) using shouldComponentUpdate
3) using PureComponent

Big components is the wrong way to structure your application, because react.js spends more time to render screen

Upvotes: 2

Related Questions