I have an issue. I want to show a different color of letters if there is no data, but there seems to be an issue with my 'if' and all the data is show with the else. Here is my code:
{letter.map((letter) => { if (letter.data == []) { return (<View><Text style={{ color: "#424242" }}>{letter.name}</Text></View> ); } else { return (<View><Text>{letter.name}</Text></View> ); } })}
And my data:
const letter = [ { id: "1", name: "A", data: ["Abricot", "Abricot", "Abricot"], }, { id: "2", name: "B", data: ["Branche", "Branche", "Branche"], }, { id: "3", name: "C", data: [], }, { id: "4", name: "D", data: ["Dalle", "Dalle", "Dalle"], }, { id: "5", name: "E", data: [], },];