Cuando agregué Arrastrar y Soltar, la clasificación por fechas y letras dejó de funcionar para mí. Entiendo que esto se debe al hecho de que ordeno cuando hago "mapa". Y agrego un nuevo método de clasificación para objetos arrastrados allí. ¿Cómo se puede arreglar esto?
Esta es mi función de arrastrar y soltar:
function dragStartHandler(e, item) { console.log(item) setCurrentItem(item) } function dragEndHandler(e) { } function dragOVerHandler(e) { e.preventDefault() } function dragHandler(e, item) { e.preventDefault() setTable([...table].map(c => { if (c.id === item.id) { return { ...c, order: currentItem.order } } if (c.id === currentItem.id) { return { ...c, order: item.order } } return c; })) } const SortItems = (a, b) => { if (a.order > b.order) { return 1 } else { return -1 } }Luego ordeno mi matriz y uso sort.
table.sort(SortItems).map((item, id) => { return ( <tr onDragStart={(e) => dragStartHandler(e, item)} onDragLeave={(e) => dragEndHandler(e)} onDragEnd={(e) => dragEndHandler(e)} onDragOver={(e) => dragOVerHandler(e)} onDrop={(e) => dragHandler(e, item)} draggable={true} key={item.id}> Pero ahora mi otra función de clasificación no funciona: 
useEffect(() => { setTable((table) => ([...table].sort((a, b) => !arrays ? a.data.year - b.data.year || a.month - b.month : b.data.year - a.data.year || b.month - a.month))) }, [arrays]) const sortByText = () => { setTable((table) => ([...table].sort((a, b) => a.text.toLocaleLowerCase > b.text.toLocaleLowerCase ? 1 : -1))) }¿Cómo puedo arreglar esto?