Hacker News new | past | comments | ask | show | jobs | submit login

Imagine I have a control with a large number (say N) of sub-components. Now something changes in the state of the control, which corresponds only to one of the sub-components. This change has to propagate to the right component. However, the shouldComponentUpdate() function is invoked on each of the components. This is O(N) work. This seems unreasonable.

To work around this, I could determine which component needs to change in the parent control. But this would mean a separation of logic.




But are you really going to have a single list of 1 million components or are you going to have 1000 components that each contain 1000 components? The second case is much more common and is handled just fine. If you really do need a 1 million top-level sub-components, then you need to look at different data structures other than just a flat list




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: