Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Share On Stumbleupon
Contact us
Hide Buttons

Pass down props using React childContextTypes in a deeply nested component tree

In our pre­vi­ous arti­cle on React child­Con­text­Types we saw how React lets you accu­mu­late props along a nested hier­ar­chy. At the time of writ­ing, I wasn’t aware that there is one more char­ac­ter­is­tic of child­Con­text­Types that is extremely handy

Prop­er­ties spec­i­fied in child­Con­text­Types are prop­a­gated along the the hier­ar­chy even if none of the inter­me­di­ate com­po­nents in the hier­ar­chy imple­ment either the getChild­Con­text method or have the child­Con­text­Types property.

See the below exam­ple for some more clar­ity and fork THIS JSFIDDLE to exper­i­ment with it yourself.


Ryan Sukale

Ryan is just a regular guy next door trying to manage his life and finances.