trivago Interview Question

How would you rewrite/optimise this component? (Example given)