static contextType = SomeContext
static contextMap = { form: FormContext, app: AppContext, }
In the example above, the context values would be available in this.form and this.app
We intentionally didn't do it for several reasons:
* It adds extra object allocations on every render which adds up when your project grows
* It's harder to express in a type system (e.g. Flow or TypeScript)
You can use the low-level Consumer API to read multiple contexts but in this particular shortcut we're not going to support it.
I don't know about flow, but TypeScript is pretty flexible there. With mapped types you should be express anything you need.
In the example above, the context values would be available in this.form and this.app