With <div>
const latestKeyedText =
cookies && cookies.searchHistory && cookies.searchHistory.length > 0 ? (
<div key={cookies.searchHistory.length - 1}>
{`${cookies.searchHistory[cookies.searchHistory.length - 1]}`}
</div>
) : null;
Without <div>
const latestKeyedText =
cookies && cookies.searchHistory && cookies.searchHistory.length > 0
? `${cookies.searchHistory[cookies.searchHistory.length - 1]}`
: null;