Add logic to update dom.