I am having an issue with sorting data with special characters. Can someone help me if this issue? I am coding in React Native
const sorted = response.data.items.sort(function (a, b) {
var textA = a.title.replace(/[^a-zA-Z0-9 ]/g, '').toUpperCase();
var textB = b.title.replace(/[^a-zA-Z0-9 ]/g, '').toUpperCase();
if (sortAscDesc) return textA < textB ? -1 : textA > textB ? 1 : 0;
if (sortAscDesc === false) return textA > textB ? -1 : textA < textB ? 1 : 0; //prettier-ignore
});
setApiData(sorted);