diff --git a/packages/react-dom/src/server/DOMMarkupOperations.js b/packages/react-dom/src/server/DOMMarkupOperations.js index 7306d9393be56..3cddbb493e07e 100644 --- a/packages/react-dom/src/server/DOMMarkupOperations.js +++ b/packages/react-dom/src/server/DOMMarkupOperations.js @@ -71,7 +71,12 @@ export function createMarkupForCustomAttribute( name: string, value: mixed, ): string { - if (!isAttributeNameSafe(name) || value == null) { + if ( + !isAttributeNameSafe(name) || + value == null || + typeof value === 'function' || + typeof value === 'symbol' + ) { return ''; } return name + '=' + quoteAttributeValueForBrowser(value); diff --git a/packages/react-dom/src/server/ReactDOMServerFormatConfig.js b/packages/react-dom/src/server/ReactDOMServerFormatConfig.js index 2a034963f48af..62f6d3ca56550 100644 --- a/packages/react-dom/src/server/ReactDOMServerFormatConfig.js +++ b/packages/react-dom/src/server/ReactDOMServerFormatConfig.js @@ -1070,7 +1070,11 @@ function pushStartCustomElement( // Ignored. These are built-in to React on the client. break; default: - if (isAttributeNameSafe(propKey)) { + if ( + isAttributeNameSafe(propKey) && + typeof propValue !== 'function' && + typeof propValue !== 'symbol' + ) { target.push( attributeSeparator, stringToChunk(propKey),