How do redux asynchronous requests state and props be properly controlled?

scenario:

now there is a pop-up box, and there is a button on the current page. Click the button to display the pop-up box.

there is an input form in the pop-up box. Click the submit button to request the interface after input. If the interface requests to close the pop-up box correctly, if an error is reported, toast prompts you not to close the current pop-up box.

now a field isShow is defined in the state on the page to control whether the pop-up box is hidden or displayed.

 let initState={
    error:false
}

then use componentWillReceiveProps on the page to determine the error status of the props, and then modify the isShow to control the pop-up box.

feels a little tedious.

or put the hidden display control of the pop-up box into the store of redux, and control the status of the pop-up box through props, which is more reasonable.


I feel that the logic of using redux to deal with writing is a bit of a killer. The asynchronous request is handled in the
onClick event to determine whether the modal box needs to be hidden based on the result.


<ul><li>redux</li></ul>
state={
    isShow:false
}
fetch()
.then(res => {
    if(res.code == 0){ //
      //
    }else{
    //toast 
    }
})
.catch(e => {
    //
)
Menu