Be the first user to complete this post

  • 0
Add to List

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

In our previous article on React childContextTypes we saw how React lets you accumulate props along a nested hierarchy. At the time of writing, I wasn't aware that there is one more characteristic of childContextTypes that is extremely handy

Properties specified in childContextTypes are propagated along the the hierarchy even if none of the intermediate components in the hierarchy implement either the getChildContext method or have the childContextTypes property.
See the below example for some more clarity and fork THIS JSFIDDLE to experiment with it yourself. [wpgist id="2a0b10b548600971ff33" file="ReactContextTypesNested.jsx"]



Also Read:

  1. Execution sequence of a React component's lifecycle methods
  2. combineReducers in reduxjs explained
  3. Require the css file of a package using webpack
  4. Uncaught TypeError: Cannot read property 'toUpperCase' of undefined in React
  5. Pass props to the handler component in react-router
  6. Pure vs Impure functions
  7. Automating Store and Action registration for multiple components using Fluxxor
  8. webpack with babel6 and react