0
catch 핸들에서 this.setState를 사용하려고 할 때 이벤트 핸들러에서 mutate 함수를 호출하고 Invariant Violation 오류가 발생합니다.아폴로 돌연변이 콜백에서 Invariant Violation 설정 상태
saveToken({data}){
let {userId, token, expires} = data.login;
storeLoginToken(userId, token, expires);
history.push('/dogs');
}
setErrors(error){
this.setState('error', error.graphQLErrors);
}
handleSubmit(event) {
event.preventDefault();
let {email, password} = this.state;
let {history} = this.props;
let clientKey = getClientKey();
this.props.mutate({ variables: { email, password, clientKey } })
.then(this.saveToken.bind(this))
.catch(this.setErrors.bind(this))
}
바보 같은 실수 덕분에 –