【发布时间】:2020-09-11 23:00:24
【问题描述】:
我试图了解 react-spring 插值是如何工作的。
这是我的春天:
const { x } = useSpring({ from: { x: 0 }, x: 100, config: { duration: 1000 } })
这是我的使用方法:
...
return (
<animated.div style={{
background: "lightblue",
height: "100%",
width: x.interpolate([0, 0.5, 1], [0, 100, 0]).interpolate(x => `${x}%`)
}} />
)
插值发生但未渲染。
这是一个沙箱:
https://codesandbox.io/s/amazing-panini-fzn54?fontsize=14&hidenavigation=1&theme=dark
你能帮我弄清楚这段代码有什么问题吗?
【问题讨论】:
标签: reactjs react-spring