-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decorator not applied on same react child components #16
Comments
Would you be able to trim down a reproducible version with a simple decorator? I don't know how |
@loganfsmyth hmm, it seems that there is problem with react-redux connect decorator cause with simple decorator all works fine. Sorry for disturbing. |
I was wrong. function wrap(wrappedComponent) {
class Wrapper extends React.Component {
render() {
return React.createElement(wrappedComponent, this.props);
}
}
return Wrapper;
};
@wrap
export class Node extends React.Component {
render() {
const nodes = [
<Node alone />,
<Node alone />,
<Node alone />
];
if(this.props.alone) {
return <div>Node</div>;
}
else {
return <div>{nodes}</div>;
}
}
} |
Perfect, thanks for the great example. I've got a busy week, but I'll try to get to this when I can. |
I'm a little on the fence on this, now that I look into it more. It seems like an edge-case where Babel 5's behavior differers from my reading of the spec. The https://github.com/wycats/javascript-decorators#desugaring-es6 ES6 class desugaring example from the decorator repo is the logic that I follow in this implementation. My reading of that would imply that usage of At the moment, I'm tempted to lean toward adding this as a third entry in the "Best Effort" list in the README. |
Any updates? |
And the console output:
On the babel 5 it's ok.
The text was updated successfully, but these errors were encountered: