React refactoring