Use react to count time spended