change data to state in delete javascript