React: xmlns:xlink (and other SVG namespaced attrs) not supported

Created on 18 Sep 2015  路  4Comments  路  Source: facebook/react

At the moment when I try to use a defs element, I get the following error:

Namespace tags are not supported. ReactJSX is not XML.

Namespaces are required for effective use of SVG. Is there a design decision not to allow namespaced tags, or is it just a feature that needs implementing?

Most helpful comment

In the interest of saving time, the solution is to use camel case:

<svg xlinkHref="http://i.imgur.com/w7GCRPb.png" />

renders to

<svg xlink:href="http://i.imgur.com/w7GCRPb.png" />

All 4 comments

Found issue #2250 which seems to solve this.

In the interest of saving time, the solution is to use camel case:

<svg xlinkHref="http://i.imgur.com/w7GCRPb.png" />

renders to

<svg xlink:href="http://i.imgur.com/w7GCRPb.png" />

This helped a lot, Thank you @agm1984

This helped a lot. It's like changing from "stroke-width" to "strokeWidth"

Was this page helpful?
0 / 5 - 0 ratings