'Ant-design table handle custom sorter by data pre-determined

My ant-design table has column has a table like this:

    {
      title: 'State',
      dataIndex: 'state',
      key: 'state',
      sorter: (a, b) => a.state.localeCompare(b.state),
    },

Currently, my client don't want too sort state by alphabet string, they want to custome the result by the string pre-determined

Failed
Rejected
Canceled
Expired
Completed

How can I implement sorter with custom data as above? Many thank



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source