React refactor