{"record":{"id":"b9ec38356460deda","repo":"facebook/react","slug":"450","errorCode":"450","errorMessage":"The current renderer does not support Singletons. This error is likely caused by a bug in React. Please file an issue.","messagePattern":"The current renderer does not support Singletons\\. This error is likely caused by a bug in React\\. Please file an issue\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-reconciler/src/ReactFiberConfigWithNoSingletons.js","lineNumber":14,"sourceCode":"/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @flow\n */\n\n// Renderers that don't support mutation\n// can re-export everything from this module.\n\nfunction shim(...args: any): any {\n  throw new Error(\n    'The current renderer does not support Singletons. ' +\n      'This error is likely caused by a bug in React. ' +\n      'Please file an issue.',\n  );\n}\n\n// Resources (when unsupported)\nexport const supportsSingletons = false;\nexport const resolveSingletonInstance = shim;\nexport const acquireSingletonInstance = shim;\nexport const releaseSingletonInstance = shim;\nexport const isHostSingletonType = shim;\nexport const isSingletonScope = shim;\n","sourceCodeStart":1,"sourceCodeEnd":28,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-reconciler/src/ReactFiberConfigWithNoSingletons.js#L1-L28","documentation":"Singletons are host nodes that must exist exactly once — in react-dom, <html>, <head>, and <body>. Renderers that don't implement singletons re-export ReactFiberConfigWithNoSingletons, where resolveSingletonInstance, acquireSingletonInstance, releaseSingletonInstance, and isHostSingletonType are throwing shims (`supportsSingletons = false`). Rendering a document-level element against such a config throws.","triggerScenarios":"Rendering 'html', 'head', or 'body' elements in a tree driven by a renderer whose host config re-exports NoSingletons — react-native, test renderers, custom renderers.","commonSituations":"Reusing full-document components (SSD-style <html> wrappers, A JSX component) on react-native or custom renderers; shared design-system components that render document shells.","solutions":["Don't render document-level tags on non-DOM renderers — branch on environment and render only the inner content.","Strip the document shell before passing the tree to the non-DOM renderer.","Custom renderer authors: implement the singleton hooks if your target has singleton-like nodes."],"exampleFix":"// before: document shell rendered everywhere\nconst Shell = ({children}) => (\n  <html><body>{children}</body></html>\n);\n\n// after: shell only for DOM renderers\nconst Shell = ({children}) =>\n  isDom ? <html><body>{children}</body></html> : <>{children}</>;","handlingStrategy":"type-guard","validationCode":"// Strip document-level elements before rendering into non-DOM renderers\nconst tree = isDom\n  ? <AppShell>{app}</AppShell> // renders html/head/body\n  : <>{app}</>;","typeGuard":"const SINGLETON_TAGS = new Set(['html', 'head', 'body']);\nfunction isSingletonHostElement(element) {\n  return Boolean(element) && typeof element === 'object' && SINGLETON_TAGS.has(element.type);\n}","tryCatchPattern":null,"preventionTips":["Never render <html>/<head>/<body> into react-native or custom renderers","Share only inner content components across platforms, keep document shells per-platform","Lint rule or codemod to flag document-level tags in native entry files"],"tags":["singletons","custom-renderer","renderer-capability","document-elements"],"backgroundTag":"renderer-capability-unsupported","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}