reactjs - Is it More Performant to Pass Props From Parent Component Or Listen to State Change In Flux Store? -
let's have following parent -> child relationship(s) inside of react component:
<parentcomponent> <childcomponent> <grandchildcomponent> <greatgrandchildcomponent></greatgrandchildcomponent> ... ... ... // , on </grandchildcomponent> </parentcomponent>
assuming i'm getting data flux store, more performant have <parentcomponent>
state / listen changes on flux store , pass relevant data down children props
or more performant have each <..child>
component listen store directly updates state?
performance depend on specific program. there reason youre concerned performance between these 2 practices? must imagine extremely minimal difference.
that being said, idiomatic react favors stateful components housing stateless components. unless theres reason child component manage (that manage own state , not let parent manage it), should composing site few stateful components possible contain many stateless children.
tl;dr pass in props parent
Comments
Post a Comment