星際農場
文章分類關於我

react常見bug

2020年2月11日

ReactJS: Warning: setState(…): Cannot update during an existing state transition
在把function當props傳給子元件的時候,子元件要呼喚此function是要這樣叫:() => this.props.onHandlexxx()  而非 直接在onClick上寫
onClick={this.props.onHandlexxx}

© 2026 星際農場. All rights reserved.