Skip to content
Advertisement

React: Table custom sort doesn’t sort when data is mixed with capital and small letters

I am trying to sort data using custom sort function in react. Unfortunately the function only sort items if the records are either capital letter or small letter. It doesn’t sort the data with mixed capital and small letter properly. Here is the live link

Here is the code

JavaScript
JavaScript
JavaScript

I have tried to change a and b to lowercase from useSortable but since there is price column with number, I got error.

What can I do to make it work regardless of case sensitivity.

Advertisement

Answer

You can check for the type, like:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement