Hi Samuel, I'm not sure if this is the most idiomatic way, but it works for me:
https://gist.github.com/vbedegi/0329db5ff5772526a34b56d59e07d320 Hope this helps On Monday, 6 March 2017 15:48:06 UTC+1, Samuel Morello wrote: > > Hi, > > I cannot find a way to make this code work in reagent clojurescript > > https://github.com/clauderic/react-sortable-hoc > > > > import React, {Component} from 'react'; > import {render} from 'react-dom'; > import {SortableContainer, SortableElement, arrayMove} from > 'react-sortable-hoc'; > > const SortableItem = SortableElement(({value}) => <li>{value}</li>); > > const SortableList = SortableContainer(({items}) => { > return ( > <ul> > {items.map((value, index) => > <SortableItem key={`item-${index}`} index={index} > value={value} /> > )} > </ul> > ); > }); > > class SortableComponent extends Component { > state = { > items: ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6'] > } > onSortEnd = ({oldIndex, newIndex}) => { > this.setState({ > items: arrayMove(this.state.items, oldIndex, newIndex) > }); > }; > render() { > return ( > <SortableList items={this.state.items} > onSortEnd={this.onSortEnd} /> > ) > } > } > > render(<SortableComponent/>, document.getElementById('root')); > > > Any tips ? > > Many thanks, > Samuel > -- You received this message because you are subscribed to the Google Groups "Reagent-Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to reagent-project+unsubscr...@googlegroups.com. To post to this group, send email to reagent-project@googlegroups.com. Visit this group at https://groups.google.com/group/reagent-project. For more options, visit https://groups.google.com/d/optout.