This repository has been archived by the owner on Jan 25, 2022. It is now read-only.
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.
Decorate a function #35
Closed
Description
openedon Jun 14, 2017
Here is my story:
Firstly, I wrote React components using HOCs pattern. Say, I have some hocs and compose them into a component like this:
compose(
hoc1,
hoc2,
...
)(function MyComponent (props) {...})
Then, I learned the decorator syntax and changed my code into such format:
@hoc1
@hoc2
...
class MyComponent extends React.Component {
render () {...}
}
But this is not perfect. The final great format should be like this:
@hoc1
@hoc2
...
function MyComponent (props) {...}
But currently decorator can not be applied to function, so sad :(
Metadata
Assignees
Labels
No labels
Activity