MCPcopy Create free account
hub / github.com/adobe/react-spectrum / SSRProvider

Function SSRProvider

packages/react-aria/src/ssr/SSRProvider.tsx:87–104  ·  view source on GitHub ↗
(props: SSRProviderProps)

Source from the content-addressed store, hash-verified

85 * This ensures that auto generated ids are consistent between the client and server.
86 */
87export function SSRProvider(props: SSRProviderProps): JSX.Element {
88 // oxlint-disable-next-line react/react-compiler
89 if (typeof React['useId'] === 'function') {
90 if (
91 process.env.NODE_ENV !== 'test' &&
92 process.env.NODE_ENV !== 'production' &&
93 !warnedAboutSSRProvider
94 ) {
95 console.warn(
96 'In React 18, SSRProvider is not necessary and is a noop. You can remove it from your app.'
97 );
98 // oxlint-disable-next-line react/react-compiler
99 warnedAboutSSRProvider = true;
100 }
101 return <>{props.children}</>;
102 }
103 return <LegacySSRProvider {...props} />;
104}
105
106let canUseDOM = Boolean(
107 typeof window !== 'undefined' && window.document && window.document.createElement

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected