Home>

I want to use react-sortable-hoc, which is a library of react, but I don't know how to pass arguments to onSortEnd.
The default is {oldIndex, newIndex}, but what are the curly braces?
I couldn't pass it well inside or outside the curly braces.
If anyone knows, please comment.

I don't know how to pass arguments

Corresponding source code
import React, {Component} from "react";
import {SortableContainer, SortableElement} from'react-sortable-hoc';
import arrayMove from'array-move';
const SortableItem = SortableElement (({value}) =><li>{value}</li>);
const SortableList = SortableContainer (({items}) =>{
  return (
  <ul>
      {items.map ((value, index) =>(
      <SortableItem key = {`item-${value}`} index = {index} value = {value} />
      ))}
  </ul>
  );
});
const Sample = () =>{
 //abridgement
  function onSortEnd ({oldIndex, newIndex, value}) {
    console.log (value);
  }
  render () {
 //abridgement
  <SortableList
                items = {value}
                onSortEnd = {() =>onSortEnd ("ok")}
              />
  }
}
export default Sample