I have a state like this one:
const [word, setWord] = useState([
{
letters: ["r", "e", "a", "c", "t"],
shows: [0, 0, 0, 0, 1],
},
]);
and I want to render a letter if shows[i] == 1, else I want to render "_".
How can I do this using map in react (or maybe some other way)? I mean something like this:
map((letter, show) => (
show == 1 ? letter : '_'
))
Aucun commentaire:
Enregistrer un commentaire