Refactoring using React