Skip to content
Docs
훅으로 돌아가기

useCountUp

@hua-labs/hua/motion

설치

bash
npm install @hua-labs/hua
Import
tsx
import { useCountUp } from "@hua-labs/hua/framework";

@hua-labs/motion-core의 모션 훅을 @hua-labs/hua/framework에서 통합 제공합니다.

UI 컴포넌트, 모션 훅, i18n을 하나의 패키지로 사용할 수 있습니다.

기본 사용법

tsx
const { display } = useCountUp({
  end: 1200,
  suffix: "+",
  active: isInView,
});

return <span>{display}</span>;

API 레퍼런스

옵션

이름타입기본값설명
endnumber-docs:hooks.use-count-up.options.end
suffixstring""docs:hooks.use-count-up.options.suffix
durationnumber1500docs:hooks.use-count-up.options.duration
delaynumber0docs:hooks.use-count-up.options.delay
activebooleantruedocs:hooks.use-count-up.options.active

반환값

이름타입설명
valuenumberdocs:hooks.use-count-up.returns.value
displaystringdocs:hooks.use-count-up.returns.display

사용 사례