Thursday, February 22, 2018
reactjs - Is it More Performant to Pass Props From Parent Component Or Listen to State Change In Flux Store?
Answer
Answer
Let's say I have the following parent -> child relationship(s) inside of a react component:
...
...
... // And so on
Assuming I'm getting data from a Flux store, is it more performant to have get its state from / listen for changes on the Flux store and then pass the relevant data down to its children as props or is it more performant to have each <..child> component listen to the store directly for any updates to its state?
Answer
Performance would likely depend on your specific program. Is there a reason youre concerned with performance between these two practices? I must imagine its an extremely minimal difference.
that being said, idiomatic react greatly favors stateful components housing stateless components. unless theres a good reason for a child component to manage itself (that is manage its own state and not let its parent manage it), you should be composing your site with as few stateful components as possible that contain many stateless children.
tl;dr pass in props from your parent
plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV
In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...
-
When the left part is an object instance, you use -> . Otherwise, you use :: . This means that -> is mostly used to access instance m...
-
I've been asked to update some Excel 2003 macros, but the VBA projects are password protected, and it seems there's a lack of docume...
-
I got a stupid problem with SQL that I can't fix. ALTER TABLE `news` ADD `dateAdded` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP AUTO...
No comments:
Post a Comment