Is there more elegant way than using if - else to append or update the data array in a React app?
Note that you do the same thing if the array is empty or if the last item's localeDate doesn't match - you can combine those two paths.

You only want to update the existing object if the last item exists and its date matches, so I'd first set a flag for that, which can be done concisely via optional chaining.

Then, .map looks a bit verbose when all items of the array are unchanged except for one - you could consider using .slice instead to take all but the last item, spread them into a new array, then add the changed object as the last item.

useEffect(() =&gt; {
    // update item if date matches
    const changeExistingItem = data[data.length - 1]?.date === localeDate;
    const updatedData = changeExistingItem
        ? [...data.slice(0, data.length - 1), { ...data[data.length - 1], round }]
        : [...data, { round, date: localeDate }];
    setData(updatedData);
}, [round]);


Also see that you can use shorthand property names to keep things concise: { someProp: someProp simplifies to { someProp in modern Javascript.

As a side note: always use const to declare variables, whenever possible. When you use let, you're warning readers of the code that you may be reassigning that variable name in the future, which results in more cognitive overhead.