{"record":{"id":"8d610eb31b3fa4bc","repo":"facebook/react","slug":"91","errorCode":"91","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/client/ReactDOMComponent.js","lineNumber":1338,"sourceCode":"        switch (propKey) {\n          case 'value': {\n            value = propValue;\n            // This is handled by initTextarea below.\n            break;\n          }\n          case 'defaultValue': {\n            defaultValue = propValue;\n            break;\n          }\n          case 'children': {\n            children = propValue;\n            // Handled by initTextarea above.\n            break;\n          }\n          case 'dangerouslySetInnerHTML': {\n            if (propValue != null) {\n              // TODO: Do we really need a special error message for this. It's also pretty blunt.\n              throw new Error(\n                '`dangerouslySetInnerHTML` does not make sense on <textarea>.',\n              );\n            }\n            break;\n          }\n          default: {\n            setProp(domElement, tag, propKey, propValue, props, null);\n          }\n        }\n      }\n      // TODO: Make sure we check if this is still unmounted or do any clean\n      // up necessary since we never stop tracking anymore.\n      validateTextareaProps(domElement, props);\n      initTextarea(domElement, value, defaultValue, children);\n      return;\n    }\n    case 'option': {\n      validateOptionProps(domElement, props);","sourceCodeStart":1320,"sourceCodeEnd":1356,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-dom-bindings/src/client/ReactDOMComponent.js#L1320-L1356","documentation":"<textarea> manages its content exclusively through the value/defaultValue props (mirroring its DOM behavior where the initial children become the default value). React's initial-properties path for textarea throws if you pass a non-null dangerouslySetInnerHTML, because injecting raw HTML into a textarea's body is meaningless — the DOM ignores it in favor of the value.","triggerScenarios":"<textarea dangerouslySetInnerHTML={{__html: 'text'}} /> on first render; component wrappers that spread an html prop onto a textarea; porting code that set textarea.innerHTML imperatively.","commonSituations":"Codebases reusing a generic Html component for any tag including textarea; converting legacy innerHTML manipulation into declarative props; template systems that render every field type through one spread.","solutions":["Use value or defaultValue instead: <textarea defaultValue={text} />","Branch your generic component so textarea never receives the html/dangerouslySetInnerHTML prop","If you need rich text editing, use a real editor component (contentEditable-based), not textarea","Strip unknown props per tag in wrapper components"],"exampleFix":"// before\n<textarea dangerouslySetInnerHTML={{__html: initialText}} />\n\n// after\n<textarea defaultValue={initialText} />","handlingStrategy":"validation","validationCode":"function TextArea({html, value, defaultValue, ...rest}: Props) {\n  // textarea: html is never valid; value/defaultValue only\n  const initial = value ?? defaultValue ?? (typeof html === 'string' ? html : undefined);\n  return <textarea {...rest} defaultValue={initial} />;\n}","typeGuard":"const isTextarea = (tag: string) => tag.toLowerCase() === 'textarea';","tryCatchPattern":null,"preventionTips":["Never reuse an Html-injecting generic component for textarea","Convert imperative textarea.innerHTML code to value/defaultValue props","Rich text belongs in contentEditable editors, not textarea"],"tags":["react-dom","textarea","dangerouslysetinnerhtml","forms"],"backgroundTag":"dangerouslysetinnerhtml-on-textarea","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}