【发布时间】:2017-04-03 18:26:05
【问题描述】:
我通过状态应用转换来响应 SVG 组件,但是它非常频繁地重新渲染,一切都滞后了。所以现在我试图避免状态更新并使用转换转换,它又非常缓慢和笨重。
componentDidMount() {
let circleElem = this.refs.circ;
let offset = 0;
setInterval(() => {
offset++;
circleElem.style.transform = "translate("+offset+"px, 0)";
}, 100);
}
render() {
return (
<circle
{...this.props.attributes}
ref='circ'
/>
);
}
这是 react 处理 SVG 的方式并且非常慢吗?或者有没有更好的方法来做这个我错过的操作?
【问题讨论】:
标签: reactjs svg css-transforms