adobe-webplatform / Snap.svg

The JavaScript library for modern SVG graphics.
http://snapsvg.io
Apache License 2.0
13.91k stars 1.15k forks source link

How do I use Snap loading svg in react? #622

Open pxim opened 4 years ago

pxim commented 4 years ago

Can i use Snap loading svg file in react like this? it's alse have svg dom.

<SVG src={'svg/s2.svg'} innerRef= {svg => {this.svgObj = svg;}} onLoad={()=>{this.initSVG(this.svgObj);}}/>

chasbeen commented 4 years ago

I just found (and am using) an excellent app to convert your Svg into a React component. https://github.com/smooth-code/svgr

Let us know how you get on, if you end up using it.. On Wednesday, November 13, 2019, 5:46:19 AM GMT, Peng Xiang notifications@github.com wrote:

Can i use Snap loading in react like this?

<SVG src={'svg/s2.svg'} innerRef= {svg => {this.svgObj = svg;}} onLoad={()=>{this.initSVG(this.svgObj);}}/>

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

pxim commented 4 years ago

an

Thanks very much,