{"record":{"id":"359d0a39eb6ab573","repo":"facebook/react","slug":"menuitems-cannot-have-children-nor-dangerouslys","errorCode":null,"errorMessage":"menuitems cannot have `children` nor `dangerouslySetInnerHTML`.","messagePattern":"menuitems cannot have `children` nor `dangerouslySetInnerHTML`\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js","lineNumber":3580,"sourceCode":"}\n\nfunction pushStartMenuItem(\n  target: Array<Chunk | PrecomputedChunk>,\n  props: Object,\n  formatContext: FormatContext,\n): ReactNodeList {\n  target.push(startChunkForTag('menuitem'));\n\n  for (const propKey in props) {\n    if (hasOwnProperty.call(props, propKey)) {\n      const propValue = props[propKey];\n      if (propValue == null) {\n        continue;\n      }\n      switch (propKey) {\n        case 'children':\n        case 'dangerouslySetInnerHTML':\n          throw new Error(\n            'menuitems cannot have `children` nor `dangerouslySetInnerHTML`.',\n          );\n        default:\n          pushAttribute(target, propKey, propValue);\n          break;\n      }\n    }\n  }\n\n  pushViewTransitionAttributes(target, formatContext);\n\n  target.push(endOfStartTag);\n  return null;\n}\n\nfunction pushTitle(\n  target: Array<Chunk | PrecomputedChunk>,\n  props: Object,","sourceCodeStart":3562,"sourceCodeEnd":3598,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js#L3562-L3598","documentation":"Thrown by pushStartMenuItem when a <menuitem> element has a non-null children or dangerouslySetInnerHTML prop. <menuitem> was a Firefox-only, since-removed autocomplete attribute holder that React treats as a leaf: it emits only a start tag with attributes and no content, so children/innerHTML props are rejected during SSR.","triggerScenarios":"Server-rendering <menuitem>{label}</menuitem> or <menuitem {...props} /> where props contains children/dangerouslySetInnerHTML.","commonSituations":"Old toolbar/context-menu markup from Firefox-era examples (the tag is deprecated and unsupported in all modern browsers); legacy HTML pasted into JSX.","solutions":["Replace <menuitem> with a real element such as <li>, <button>, or <div role=\"menuitem\"> that can hold children","If you must keep the tag, render its label as an attribute (e.g. label={text}) rather than children"],"exampleFix":"// before\n<menuitem label={label}>{label}</menuitem>\n\n// after\n<div role=\"menuitem\">{label}</div>","handlingStrategy":"type-guard","validationCode":"// treat menuitem like other leaf tags before rendering\nconst {children, dangerouslySetInnerHTML, ...rest} = props;\nreturn <menuitem {...rest} />;","typeGuard":"type MenuItemProps = {children?: never; dangerouslySetInnerHTML?: never; [k: string]: unknown};","tryCatchPattern":null,"preventionTips":["Avoid the deprecated <menuitem> tag entirely; use role=\"menuitem\" on real elements","Keep attribute-only content on tags that emit no end tag"],"tags":["ssr","menuitem","void-element","children","deprecated"],"backgroundTag":"void-element-children","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}