setting path in state when it changes