Embross interview question

How would you solve this React issue