0
ReactJS에서 변수 키 이름을 setState
으로 전달하는 올바른 방법은 무엇입니까? 나 자신, 라 임시지도 경기에 출전 할 필요 찾는거야프로그래밍 방식으로 생성 된 반응 상태 키 이름
removeLookup(idx) {
let lookupPrefix = this.composeKeys(Editor.fooDefinition, "lookups");
let arraySizeKey = this.composeKeys(lookupPrefix, Editor.arrayLengthKey);
let lookupCount = this.state[arraySizeKey];
let newState = new Map();
newState[arraySizeKey] = lookupCount - 1;
newState[this.composeKeys(lookupPrefix, Editor.isDeletedKey)] = true;
this.setState(newState);
}
그것은 작동하지만 오히려 단지, 특히 경우에, 대신 선행지도를 구축, 각각의 수정과 setState
를 호출 할 위치 I 만 그러한 수정을 한 번하십시오.
. 언급 :지도. – kolosy