react icon indicating copy to clipboard operation
react copied to clipboard

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

Open richard-uk1 opened this issue 11 years ago • 5 comments

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?

richard-uk1 avatar Sep 18 '15 16:09 richard-uk1

Found issue #2250 which seems to solve this.

richard-uk1 avatar Sep 18 '15 16:09 richard-uk1

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" />

agm1984 avatar Feb 27 '18 20:02 agm1984

This helped a lot, Thank you @agm1984

abhinavsri360 avatar Apr 11 '20 18:04 abhinavsri360

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

hungdoansy avatar Apr 24 '20 10:04 hungdoansy

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" />

Obrigado agm1984, Lembrando que para <svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 24 150 28 " /> Mesma ideia <svg xmlnsXlink="http://www.w3.org/1999/xlink" viewBox="0 24 150 28 " />

por ai vai valew !!!

gbyteinfo avatar Dec 13 '21 02:12 gbyteinfo