export default function ProgressModal({ ..., squaresString, gameNo }) { ... function shareResult() { ... guesses.forEach((formattedGuess) => { ... formattedGuess.forEach((letterObj, index) => { if (letterObj.color === "green") { squaresString += "🟩"; } else if (letterObj.color === "yellow") { squaresString += "🟨"; } else { squaresString += "⬛"; } //because indexes in split are indexes in which // there is a space *after* if (split.includes(index)) { squaresString += " "; } }); squaresString += "\n"; } ... } ...