Moved react logic to its own class