Advanced React router prompt support beforeunload
npm install @rcp/c.prompt react-router
# or use yarn
yarn add @rcp/c.prompt react-router
import Prompt, { PromptProvider } from '@rcp/c.prompt'
render(
<PromptProvider>
<Prompt when={true} message="Prompt Tips" />
</PromptProvider>
)
// 自定义 Prompt 弹窗视图
render(
<PromptProvider
getPromptComponent={({ message, close }) => <Modal onOk={() => close(true)} onCancel={() => close(false)} />}
>
<Prompt when={true} message="Prompt Tips" />
</PromptProvider>
)
This library is written and maintained by 余聪, yucong06@meituan.com.
MIT