Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component, createRef } from 'react'
- const svg = `
- <svg height="100" width="100">
- <circle
- cx="50"
- cy="50"
- r="40"
- stroke="black"
- stroke-width="3"
- fill="red" />
- </svg>
- `
- class Svg extends Component {
- constructor () {
- super()
- this.domRef = createRef()
- }
- componentDidMount () {
- this.domRef.current.innerHTML = svg
- }
- render () {
- return <div ref={this.domRef}></div>
- }
- }
- export default Svg
Add Comment
Please, Sign In to add comment