1 | import { useInitialized } from './use-initialized';
|
2 | export const ShouldRender = props => {
|
3 | const shouldRender = useShouldRender(props.active, props.forceRender, props.destroyOnClose);
|
4 | return shouldRender ? props.children : null;
|
5 | };
|
6 | export function useShouldRender(active, forceRender, destroyOnClose) {
|
7 | const initialized = useInitialized(active);
|
8 | if (forceRender) return true;
|
9 | if (active) return true;
|
10 | if (!initialized) return false;
|
11 | return !destroyOnClose;
|
12 | } |
\ | No newline at end of file |