Context Variables

Use context variables to pass down data with Transcrypt.

Introducing context variables

When passing props down multiple levels to where they are needed, it can involve a lot of repetitive code, and it can be tedious to keep track of them. To help in this situation, React has a set of methods that can be used to create the equivalent of what would be component-scoped global props. That is, a context variable that works just like component props, but can be accessed anywhere it is created in the component tree below. We use this mechanism so a prop ...