-
Notifications
You must be signed in to change notification settings - Fork 49.2k
Closed
Labels
React 18Bug reports, questions, and general feedback about React 18Bug reports, questions, and general feedback about React 18Type: Discussion
Description
If you use the bootstrapScriptContent
option of renderToPipeableStream()
to provide hydration data (as recommended in the <script> upgrade guide) with JSON.stringify()
it doesn’t work because React escapes HTML characters in bootstrapScriptContent
like quotes. I’ve worked around this by using backticks to deliniate strings.
What’s the correct thing to do here?
react/packages/react-dom/src/server/ReactDOMServerFormatConfig.js
Lines 99 to 105 in cdb8a1d
if (bootstrapScriptContent !== undefined) { | |
bootstrapChunks.push( | |
inlineScriptWithNonce, | |
stringToChunk(escapeTextForBrowser(bootstrapScriptContent)), | |
endInlineScript, | |
); | |
} |
Metadata
Metadata
Assignees
Labels
React 18Bug reports, questions, and general feedback about React 18Bug reports, questions, and general feedback about React 18Type: Discussion