Updated component hook implementation with an Event driven version, provides greater flexibility.