blob: 67ce4c55493008e3fb49ce40be6c7d30634d9ae9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import React, { useContext } from 'react';
// This context tells its subtree if it should stop rendering or not. This is useful during
// transitions, e.g. on log out, since data might be updated which makes the disappearing view
// update a lot during the transition. There's currently no support for unpausing, which can be
// added later if needed.
const willExitContext = React.createContext<boolean>(false);
export const WillExit = willExitContext.Provider;
export function useWillExit() {
return useContext(willExitContext);
}
|