{"record":{"id":"fc52dd1e4751842f","repo":"facebook/react","slug":"the-style-prop-expects-a-mapping-from-style-prop","errorCode":null,"errorMessage":"The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.","messagePattern":"The `style` prop expects a mapping from style properties to values, not a string\\. For example, style=(.+?)\\} when using JSX\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js","lineNumber":1273,"sourceCode":"    return chunk;\n  }\n  const result = stringToPrecomputedChunk(\n    escapeTextForBrowser(hyphenateStyleName(styleName)),\n  );\n  styleNameCache.set(styleName, result);\n  return result;\n}\n\nconst styleAttributeStart = stringToPrecomputedChunk(' style=\"');\nconst styleAssign = stringToPrecomputedChunk(':');\nconst styleSeparator = stringToPrecomputedChunk(';');\n\nfunction pushStyleAttribute(\n  target: Array<Chunk | PrecomputedChunk>,\n  style: Object,\n): void {\n  if (typeof style !== 'object') {\n    throw new Error(\n      'The `style` prop expects a mapping from style properties to values, ' +\n        \"not a string. For example, style={{marginRight: spacing + 'em'}} when \" +\n        'using JSX.',\n    );\n  }\n\n  let isFirst = true;\n  for (const styleName in style) {\n    if (!hasOwnProperty.call(style, styleName)) {\n      continue;\n    }\n    // If you provide unsafe user data here they can inject arbitrary CSS\n    // which may be problematic (I couldn't repro this):\n    // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet\n    // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/\n    // This is not an XSS hole but instead a potential CSS injection issue\n    // which has lead to a greater discussion about how we're going to\n    // trust URLs moving forward. See #2115901","sourceCodeStart":1255,"sourceCodeEnd":1291,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js#L1255-L1291","documentation":"Error \"The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.\" thrown in facebook/react.","triggerScenarios":"Thrown at packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js:1273 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}