Thursday, 22 February 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
casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV
In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...
-
The whole error output being: LNK2019 unresolved external symbol wWinMain referenced in function "int __cdecl __scrt_common_main_seh(vo...
-
I have come across CORS issues multiple times and can usually fix it but I want to really understand by seeing this from a MEAN stack paradi...
-
I recently used canvas to conert images to webp, using : const dataUrl = canvas.toDataURL('image/webp'); But this takes a lots of ti...
No comments:
Post a Comment