understanding react lifecycle- not yet working