Refactor inline react js out of view