You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm fetching my sortable items asynchronously via fetch. Unfortunately they are not rerendered after the state has been updated when inside a Sortable-component.
Items not in a "Sortable"-component are rendered just fine:
importReactfrom'react';importSortablefrom'react-anything-sortable';importDemoHOCItemfrom'../components/DemoHOCItem.js';exportdefaultclassVerticalextendsReact.Component{constructor(){super();this.state={items: ['four','five','six']};}componentDidMount(){console.log('Loading Route Sequences from server')fetch('http://uberfl.us/sortable.json').then(response=>{returnresponse.json()}).then(items=>{this.setState(items)console.log(items)})};render(){functionrenderWithSortable(renderItem,index){return(<DemoHOCItemclassName="vertical"sortData="renderItem"key={index}>{console.log('rendering items')}{renderItem+' sortable'}</DemoHOCItem>);}functionrenderWithoutSortable(renderItem,index){return(<DemoHOCItemclassName="vertical ui-sortable-item"key={index}>{console.log('rendering without sortable')}<divclassName='vertical ui-sortable-item'>{renderItem+' not sortable'}</div></DemoHOCItem>);}return(<divclassName="demo-container"><SortableclassName="vertical-container"direction="vertical">{this.state.items.map(renderWithSortable,this)}</Sortable><br/><divclassName="vertical-container">{this.state.items.map(renderWithoutSortable,this)}</div></div>);}}
The text was updated successfully, but these errors were encountered:
I'm fetching my sortable items asynchronously via fetch. Unfortunately they are not rerendered after the state has been updated when inside a Sortable-component.
Items not in a "Sortable"-component are rendered just fine:
Here's an example based on Demo vertically sorting:
The text was updated successfully, but these errors were encountered: