UNPKG

789 BJavaScriptView Raw
1'use strict';
2
3import React from 'react';
4function getCurrentReactOwner() {
5 const ReactSharedInternals =
6 // @ts-expect-error React secret internals aren't typed
7 React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED ||
8 // @ts-expect-error React secret internals aren't typed
9 React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
10 return ReactSharedInternals?.ReactCurrentOwner?.current;
11}
12export function isReactRendering() {
13 return !!getCurrentReactOwner();
14}
15export function isFirstReactRender() {
16 const currentOwner = getCurrentReactOwner();
17 // alternate is not null only after the first render and stores all the
18 // data from the previous component render
19 return currentOwner && !currentOwner?.alternate;
20}
21//# sourceMappingURL=reactUtils.js.map
\No newline at end of file