डॉक्स / फ़्रेमवर्क
React Router
फ़्रेमवर्क मोड में React Router ऐप में UI Loft आइटम जोड़ें। नए ऐप Tailwind और इम्पोर्ट alias के साथ आते हैं, इसलिए यह तीन कमांड हैं।
- वर्शन
- React
- ज़रूरत
- Tailwind 4 + shadcn
- सेटअप का समय
- करीब 2 मिनट
सेट करें
ऐप बनाएँ
अगर आपके पास पहले से है तो इसे छोड़ दें।
--yesडिफ़ॉल्ट लेता है।टर्मिनलnpx create-react-router@latest my-app --yes cd my-appshadcn सेट करें
यह एक
components.jsonबनाता है जो बताता है कि नई फ़ाइलें कहाँ जाएँ।-dडिफ़ॉल्ट लेता है।टर्मिनलnpx shadcn@latest init -dआइटम जोड़ें
किसी भी आइटम पेज से कमांड कॉपी करें। फ़ाइल
app/components/में आती है।टर्मिनलnpx shadcn@latest add https://uiloft.dev/r/glow-button.jsonइस्तेमाल करें
इसे किसी रूट में इम्पोर्ट करें।
app/routes/home.tsximport { GlowButton } from "~/components/glow-button" export default function Home() { return <GlowButton>Get started</GlowButton> }
जानने लायक
- इम्पोर्ट
~/से शुरू होते हैं,@/से नहीं। shadcn आइटम के अपने इम्पोर्ट उसी के अनुसार बदल देता है। - पुराने या हाथ से बने ऐप को shadcn सेट करने से पहले Tailwind 4 और
~/*path alias चाहिए। - ये स्टेप React Router 8 के साथ जाँचे गए थे।