React-Redux Thunk调用Flask API出现TypeError与Network Error排查
Let’s walk through the hints from your error logs and code structure to help you zero in on the problem:
Reducer State Completeness: In your
devsReducer, when handling theStart_Dev_Searchaction, you’re returning a new state object that only includesisFetching: true—but you’re omitting the existingdevsArrayfrom the previous state. Redux reducers need to preserve all unchanged state properties when updating; failing to do this can lead to unexpected state shape issues later in your component.Context Binding in
renderList: When you callthis.props.devsArray.map(this.renderList), therenderListmethod loses its component context (thethisvalue). This means whenrenderListtries to accessthis.props.selectAd,thismight be undefined—directly causing theTypeError: e is undefinedyou’re seeing.Network Error Mismatch: Even though Fiddler shows the request succeeded, axios might be throwing a network error due to a misconfigured response (like incorrect content type, browser-unrecognized CORS headers, or a parsing issue with the response data). Double-check how your Flask API sets response headers and the format of the returned data.
内容的提问来源于stack exchange,提问作者rishe

