SVG use tag and ReactJS

后端 未结 6 1535
慢半拍i
慢半拍i 2020-12-23 00:05

So normally to include most of my SVG icons that require simple styling, I do:


    
         


        
6条回答
  •  执念已碎
    2020-12-23 00:45

    Update september 2018: this solution is deprecated, read Jon’s answer instead.

    --

    React doesn’t support all SVG tags as you say, there is a list of supported tags here. They are working on wider support, f.ex in this ticket.

    A common workaround is to inject HTML instead for non-supported tags, f.ex:

    render: function() {
        var useTag = '';
        return ;
    }
    

提交回复
热议问题