React-Spring,Hooks的用法 发表于 2019-01-27 | 更新于: 2019-04-28 | 分类于 技术备忘 | 阅读次数: 字数统计: 86 | 阅读时长 ≈ 1 React-Spring,Hooks的用法React-Hooks让组件的状态管理简洁了很多。下面是React-Spring的Hooks用法 123456789101112131415//Hooks.jsximport React from 'react';import { useSpring, animated } from 'react-spring';const HookedComponent = () => { const [props] = useSpring({ opacity: 1, color: 'white', from: { opacity: 0 }, delay: '2000' }) return <animated.div style={props}>This text Faded in Using hooks</animated.div>}export default HookedComponent;