Guest User

Untitled

a guest
Jan 24th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. import React, { Component, createRef } from 'react'
  2.  
  3. const svg = `
  4. <svg height="100" width="100">
  5. <circle
  6. cx="50"
  7. cy="50"
  8. r="40"
  9. stroke="black"
  10. stroke-width="3"
  11. fill="red" />
  12. </svg>
  13. `
  14.  
  15. class Svg extends Component {
  16. constructor () {
  17. super()
  18. this.domRef = createRef()
  19. }
  20.  
  21. componentDidMount () {
  22. this.domRef.current.innerHTML = svg
  23. }
  24.  
  25. render () {
  26. return <div ref={this.domRef}></div>
  27. }
  28. }
  29.  
  30. export default Svg
Add Comment
Please, Sign In to add comment