React: Server side rendering: "Warning: <linearGradient /> is using uppercase HTML. Always use lowercase HTML tags in React."

Created on 9 Aug 2017  路  2Comments  路  Source: facebook/react

Do you want to request a feature or report a bug?

Report a bug.

What is the current behavior?

Whenever I render SVG elements that are camel cased (e.g. <linearGradient />) on the server side, I get the following warning:

Warning: <linearGradient /> is using uppercase HTML. Always use lowercase HTML tags in React.

What is the expected behavior?

Warnings should be consistent with the client side rendering, if possible. In this case, I'd expect no warning, since using camel cased SVG element names is pretty standard.

For client side rendering, there seems to be a check for the current namespace:

https://github.com/facebook/react/blob/efcac24af26afba90e2ef525509ca40f3bd6f270/src/renderers/dom/fiber/ReactDOMFiberComponent.js#L344-L352

For server side rendering, there seems to be currently no such check in place:

https://github.com/facebook/react/blob/81706eeb7a51c1cea7fd8e66733a4f4618155ef5/src/renderers/shared/server/ReactPartialRenderer.js#L537-L544

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

Hitting this on 16.0.0-beta.5. Was not hitting it on 15.6.1, the version I was previously on.

Thanks in advance.

Bug

Most helpful comment

Looks like server side is missing the namespace check.

All 2 comments

Looks like server side is missing the namespace check.

Oh, seems like I'm getting this issue too.

In my case, I'm using renderToStaticMarkup on the client-side to put some of the React code into pure HTML body. Don't ask me why :)

Error:
Warning: <linearGradient /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.

React: 16.12.0
React-Dom: 16.12.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jvorcak picture jvorcak  路  3Comments

zpao picture zpao  路  3Comments

trusktr picture trusktr  路  3Comments

hnordt picture hnordt  路  3Comments

framerate picture framerate  路  3Comments