Open ivmarkov opened 7 years ago
I agree the default path for components should exclude context. In general, I stayed away from prop types. Given the typed nature of java, they are less important. Although, they can still catch some runtime bugs when you are building props on the fly.
Regarding prop types - you misunderstood. Of course they are unnecessary in a typed environment like Java (or TypeScript or Flow). However, the context types (mind you: not prop types), while unnecessary as well for us are - unfortunately - required by React. See here: https://facebook.github.io/react/docs/context.html
If contextTypes is not defined, then context will be an empty object.
I currently have no need for context support. However, I would happily take a pull request to add support
Let's leave it open for now, if you don't mind. We also don't see much use for contexts right now.
I will address this with React 16.3
As the React documentation (https://facebook.github.io/react/docs/context.html) for context says:
At the same time, the current support for contexts in GwtReact is:
C extends BaseContext
. Removing it means instead of writingwe can write:
... which is shorter and simpler.
In my opinion, context should probably be supported, but should not be "seen" by the user when not in use. One simple way to do this is to simplify
StatelessComponent
as suggested here, and then in parallel introduce aStatelessComponentWithContext
or suchlike, which would be the context-aware alternative ofStatelessComponent
, with a second "context" parameter, support for contextTypes static (somehow) and so on and so forth.