MCPcopy Index your code
hub / github.com/react/react / pushInnerHTML

Function pushInnerHTML

packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js:1853–1881  ·  view source on GitHub ↗
(
  target: Array<Chunk | PrecomputedChunk>,
  innerHTML: any,
  children: any,
)

Source from the content-addressed store, hash-verified

1851const endOfStartTagSelfClosing = stringToPrecomputedChunk('/>');
1852
1853function pushInnerHTML(
1854 target: Array<Chunk | PrecomputedChunk>,
1855 innerHTML: any,
1856 children: any,
1857) {
1858 if (innerHTML != null) {
1859 if (children != null) {
1860 throw new Error(
1861 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.',
1862 );
1863 }
1864
1865 if (typeof innerHTML !== 'object' || !('__html' in innerHTML)) {
1866 throw new Error(
1867 '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' +
1868 'Please visit https://react.dev/link/dangerously-set-inner-html ' +
1869 'for more information.',
1870 );
1871 }
1872
1873 const html = innerHTML.__html;
1874 if (html !== null && html !== undefined) {
1875 if (__DEV__) {
1876 checkHtmlStringCoercion(html);
1877 }
1878 target.push(stringToChunk('' + html));
1879 }
1880 }
1881}
1882
1883// TODO: Move these to RenderState so that we warn for every request.
1884// It would help debugging in stateful servers (e.g. service worker).

Callers 13

pushStartAnchorFunction · 0.85
pushStartObjectFunction · 0.85
pushStartSelectFunction · 0.85
pushStartOptionFunction · 0.85
pushStartFormFunction · 0.85
pushStartButtonFunction · 0.85
pushStyleImplFunction · 0.85
pushStyleContentsFunction · 0.85
pushTitleImplFunction · 0.85
pushScriptImplFunction · 0.85
pushStartGenericElementFunction · 0.85

Calls 3

checkHtmlStringCoercionFunction · 0.90
stringToChunkFunction · 0.90
pushMethod · 0.65

Tested by

no test coverage detected