1 | import * as React from 'react';
|
2 | import * as PropTypes from 'prop-types';
|
3 | const Context = React.createContext();
|
4 |
|
5 | if (process.env.NODE_ENV !== 'production') {
|
6 | Context.displayName = 'RenderContext';
|
7 | }
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | export function RenderContext({
|
14 | children
|
15 | }) {
|
16 | return React.createElement(Context.Provider, {
|
17 | value: "render"
|
18 | }, children);
|
19 | }
|
20 | process.env.NODE_ENV !== "production" ? RenderContext.propTypes = {
|
21 | children: PropTypes.node.isRequired
|
22 | } : void 0;
|
23 | export function useIsSsr() {
|
24 | return React.useContext(Context) === 'render';
|
25 | } |
\ | No newline at end of file |