본문으로 건너뛰기
언어22
메뉴

문서 / 프레임워크

React Router

framework 모드의 React Router 앱에 UI Loft 아이템을 추가하세요. 새 앱에는 Tailwind와 import 별칭이 기본으로 들어 있어서 명령어 세 개면 돼요.

버전
React
필요
Tailwind 4 + shadcn
설정 시간
약 2분

설정

  1. 앱 만들기

    이미 앱이 있다면 건너뛰세요. --yes는 기본값을 써요.

    터미널
    npx create-react-router@latest my-app --yes
    cd my-app
  2. shadcn 설정

    새 파일이 들어갈 위치를 정하는 components.json이 만들어져요. -d는 기본값을 써요.

    터미널
    npx shadcn@latest init -d
  3. 아이템 추가

    아이템 페이지에서 명령어를 복사하세요. 파일은 app/components/에 들어가요.

    터미널
    npx shadcn@latest add https://uiloft.dev/r/glow-button.json
  4. 사용하기

    라우트에서 import하세요.

    app/routes/home.tsx
    import { GlowButton } from "~/components/glow-button"
    
    export default function Home() {
      return <GlowButton>Get started</GlowButton>
    }

알아 두면 좋아요

  • import는 @/가 아니라 ~/로 시작해요. shadcn이 아이템 내부 import도 맞춰 바꿔 줘요.
  • 오래됐거나 직접 구성한 앱이라면 shadcn 설정 전에 Tailwind 4와 ~/* 경로 별칭이 필요해요.
  • 이 단계는 React Router 8에서 확인했어요.

다른 프레임워크