You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
点击确定按钮,调接口,接口报错,modal content展示“出错了”,关闭modal, 再次打开,由于
request.error
状态依旧存在,因此modal content依旧展示"出错了"。useRequest
提供了mutate()
方法,用来mutate
data, 是否提供mutateError()
方法,用来mutate
error。在关闭modal时调用mutateError(undefined)
,将error状态清空调整组件结构,每次打开modal创建新的组件实例,将
useRequest
放在该组件中可以解决,useRequest
每次都创建组件实例的本地状态,但需要调整组件结构。Beta Was this translation helpful? Give feedback.
All reactions