Skip to content
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

Use generator syntax to support decorator #5

Merged
merged 2 commits into from Mar 11, 2016
Merged

Use generator syntax to support decorator #5

merged 2 commits into from Mar 11, 2016

Conversation

kjanoudi
Copy link
Contributor

This allows us to use a decorator when connecting the component, as is typically standard in higher order components for ES6. http://asaf.github.io/blog/2015/06/23/extending-behavior-of-react-components-by-es6-decorators/

We're now able to do this:

import Sortable from 'react-sortablejs'

@connect(
    (state) => ({
        ...state.myItems
    })
)
@Sortable({
    ref: 'list',
    model: 'myItems'
})
export default class RestaurantInventoryItems extends React.Component {

...
}

@cheton
Copy link
Collaborator

cheton commented Mar 11, 2016

It looks awesome! Thanks for sharing this.

cheton added a commit that referenced this pull request Mar 11, 2016
Use generator syntax to support decorator
@cheton cheton merged commit 952a39a into SortableJS:master Mar 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants