Closed Artazor closed 7 years ago
This is not something that is within the scope of this JSX spec since it is already expressable in the syntax form that this spec provides. Everything about the actual semantics is defined by each library. Therefore the issue on the React repo was the correct place to have the discussion.
[holy-war question alert!] copied from https://github.com/facebook/react/issues/8714
Would it be possible to provide
this
context into SFCs when they are invoked viaJSXMemberExpression . JSXIdentifier
syntactic form?My use-case involves unusual ES6 class usage. I'm using them as inheritable containers for SFC's, where individual components could be overridden in descendant classes.
Now I'm forced to autobind all view-methods:
A bit more complete example could be found at: https://jsfiddle.net/69z2wepo/67046/
I understand that it is a Holy War question about pure functions and
this
in JavaScript. However I'm thinking that this usage ofthis
is legit. Just like achildren
in props.It is way too ugly writing:
Isn't it?
I even would be happy if
would be treated as
just like
children
- provide some special member in props. However it could be problematic as it will clash with existing user code.