react-fullpage는 React 기반의 웹 애플리케이션에서 전체 화면을 차지하는 페이지를 쉽게 구현할 수 있도록 도와주는 라이브러리입니다.
npm을 사용하여 설치할 수 있습니다.
npm install @shinyongjun/react-fullpage
또는 yarn을 사용할 수도 있습니다.
yarn add @shinyongjun/react-fullpage
라이브러리의 간단한 사용 예제 코드입니다.
'use client';
import { useState } from 'react';
import { FullpageContainer, FullpageSection } from '@shinyongjun/react-fullpage';
import '@shinyongjun/react-fullpage/css';
function MyPage() {
const [activeIndex, setActiveIndex] = useState<number>(0);
return (
<FullpageContainer
activeIndex={activeIndex}
setActiveIndex={setActiveIndex}
>
<FullpageSection>
<div>Section 1</div>
</FullpageSection>
<FullpageSection>
<div>Section 2</div>
</FullpageSection>
<FullpageSection>
<div>Section 3</div>
</FullpageSection>
<FullpageSection isAutoHeight>
<footer>Footer</footer>
</FullpageSection>
</FullpageContainer>
);
}
export default MyPage;