{"record":{"id":"371a5b09453e32d0","repo":"facebook/react","slug":"dangerouslysetinnerhtml-does-not-make-sense-on","errorCode":null,"errorMessage":"`dangerouslySetInnerHTML` does not make sense on <textarea>.","messagePattern":"`dangerouslySetInnerHTML` does not make sense on <textarea>\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js","lineNumber":2782,"sourceCode":"  let children = null;\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          children = propValue;\n          break;\n        case 'value':\n          value = propValue;\n          break;\n        case 'defaultValue':\n          defaultValue = propValue;\n          break;\n        case 'dangerouslySetInnerHTML':\n          throw new Error(\n            '`dangerouslySetInnerHTML` does not make sense on <textarea>.',\n          );\n        default:\n          pushAttribute(target, propKey, propValue);\n          break;\n      }\n    }\n  }\n  if (value === null && defaultValue !== null) {\n    value = defaultValue;\n  }\n\n  pushViewTransitionAttributes(target, formatContext);\n\n  target.push(endOfStartTag);\n\n  // TODO (yungsters): Remove support for children content in <textarea>.\n  if (children != null) {","sourceCodeStart":2764,"sourceCodeEnd":2800,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js#L2764-L2800","documentation":"Thrown by pushStartTextArea when a <textarea> element has a dangerouslySetInnerHTML prop. A textarea's content in HTML is its initial value; setting innerHTML on it is meaningless (the DOM value would override it), so React rejects the combination during server serialization.","triggerScenarios":"Server-rendering <textarea dangerouslySetInnerHTML={{__html: text}} /> — usually an attempt to set the textarea's content via raw HTML instead of the value/defaultValue props.","commonSituations":"HTML-to-JSX conversion of <textarea>some content</textarea> into the wrong prop; generic components that apply dangerouslySetInnerHTML to whatever tag they render; developers unfamiliar with the textarea-as-value model in React.","solutions":["Use value/defaultValue: <textarea defaultValue={text} /> (uncontrolled) or value+onChange (controlled)","Remove dangerouslySetInnerHTML from any component that can render a textarea","If the goal was default content, note that React maps that to defaultValue, not children or innerHTML"],"exampleFix":"// before\n<textarea dangerouslySetInnerHTML={{__html: text}} />\n\n// after\n<textarea defaultValue={text} />","handlingStrategy":"validation","validationCode":"if (process.env.NODE_ENV !== 'production' && props.dangerouslySetInnerHTML != null && tagName === 'textarea') {\n  throw new TypeError('textarea does not support dangerouslySetInnerHTML; use value/defaultValue');\n}","typeGuard":"type TextareaProps = Omit<JSX.IntrinsicElements['textarea'], 'dangerouslySetInnerHTML'>;","tryCatchPattern":null,"preventionTips":["Treat textarea content as value/defaultValue only","Omit dangerouslySetInnerHTML from shared prop types that flow into textareas","Review HTML-to-JSX converter output for textarea patterns"],"tags":["ssr","textarea","dangerouslysetinnerhtml"],"backgroundTag":"textarea-children-misuse","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}