react组件卸载前的钩子

react

参考:https://lequ7.com/2019/01/16/javascript/React-zu-jian-xie-zai-lu-you-tiao-zhuan-ye-mian-guan-bi-shua-xin-zhi-qian-jin-xing-ti-shi/

import {Prompt} from ‘react-router-dom’;

const Editor=()=>{

return (

<div>

<Prompt

// when相当于disabled,为true时,当react路由跳转就会触发

when={true}

message={location => ‘文章要保存吼,确定离开吗?’}

/>

</div>

)

}

以上是 react组件卸载前的钩子 的全部内容, 来源链接: utcz.com/z/382318.html

回到顶部