【发布时间】:2019-04-14 12:33:37
【问题描述】:
如何使用 react-spring 库对 React 组件进行动画处理取决于 props 更新
我找到了这个https://codesandbox.io/s/xpqq0ll5nw 并想用钩子实现同样的功能
const Counter = ({quantity}) => {
const animation = useSpring({
transform: 'scale(1)',
from: { transform: 'scale(1.2)' },
});
return (
<animated.span style={animation}">
{quantity}
</animated.span>
)
}
【问题讨论】:
标签: reactjs react-spring