import React from 'react';
import * as d3 from 'd3'
import './Dthree.css'
class Dthree extends React.Component{
constructor(props){
super(props)
this.useD3 = this.useD3.bind(this)
}
componentDidMount(){
this.useD3()
}
useD3() {
const svg1 = d3.select('#container')
.append('svg')
.attr("width", 500)
.attr("height", 250)
const g = d3.select('svg')
.append('g')
.attr('transform', 'translate(50,50)')
.style('width','50px')
}
render () {
return (
<div id='container'>
</div>
)
}
}
export default Dthree
添加的那个属性无效你要说清楚啊 ?