useSpring
1. 모듈 불러오기
import {useSpring, animated} from 'react-spring'2. 사용하기
2.1 기본 사용 방법
import {useSpring, animated} from 'react-spring'
function App() {
const props = useSpring({to: {opacity: 1}, from: {opacity: 0}})
return <animated.div style={props}>I will fade in</animated.div>
}2.2 useSpring 속성
const props = useSpring({
// 마지막에 보여지는 스타일 속성
to: { opacity: 1, color: '#fff' },
// 처음 보여지는 기본 스타일
from: { color: '#73e77f' },
// 지연 시간
delay: 1000,
})2.3 마지막 프레임
2.4 조건 처리
2.5 사용자 정의 transition
2.5.1 방법 1
2.5.2 방법 2
3. 키워드
3.1 키워드 단축키
4. 실습
Last updated