Build a React + TailwindCSS component library with tsdown Originally published at bosher.co.nz Learn how to build tiny, reusable React component libraries styled with TailwindCSS and bundled superfast with tsdown - all with minimal configuration. What you'll build: A production-ready React component library with TailwindCSS styling, complete with a playground Time to complete: 45-60 minutes Skill level: Intermediate (familiarity with React, node and npm packages recommended) AI Disclaimer: This article was written entirely by myself, a human. However, LLMs were used to help with grammar and spelling checks. TL;DR - Quick Setup Here's the express version if you're already familiar with the concepts: Create a project: pnpm dlx create-tsdown@latest your-project-name -t react Add react and react/jsx-runtime to the external array in tsdown.config.ts Install dependencies: pnpm add -D tailwindcss @bosh-code/tsdown-plugin-inject-css @bosh-code/tsdown-plugin-tailwindcss Configure the plugins in your tsdown config Add @import "tailwindcss"; to src/i https://lnkd.in/g-7-xAKn
How to Build a React + TailwindCSS Library with tsdown
More Relevant Posts
-
Tired of wrangling with cumbersome relative imports like `../../../../utils/helpers` in your JavaScript or TypeScript projects? Let’s delve into a game-changer often overlooked: Alias imports using '@' notation! Making the switch to aliases enhances your code's cleanliness, brevity, and maintenance ease. Instead of convoluted relative paths, configure your project (e.g., in tsconfig.json or webpack) to employ absolute-like imports. For instance: - Before: `import { helper } from '../../../utils/helpers';` 😩 - After: `import { helper } from '@utils/helpers';` 😎 Why opt for @ aliases? - Crystal-clear imports: Bid farewell to dot and slash counting—readability triumphs! - Seamless refactoring: Relocate files sans import disruptions throughout your codebase. - Reduced bugs: Adios to path errors in team projects or restructuring scenarios. - Scalability: Ideal for expanding apps with evolving directory structures. Setting up is a breeze—just minutes! In tsconfig.json, for instance: `"paths": { "@utils/*": ["src/utils/*"] }`. Functions seamlessly in React, Next.js, or any contemporary JS framework. ✨ So, what's your primary import challenge? 🤔 Have you experimented with alias imports, or are you still grappling with relative paths? Share your insights—I'm eager to learn your perspective! Bonus: Unveil your top dev trick for enhanced productivity! 👇 Let's kick-start this dialogue! #JavaScript #TypeScript #WebDevelopment #CodingHacks
To view or add a comment, sign in
-
Day 3 — Reconciliation and diffing algorithm Understanding JSX in React.js Reconciliation is the process by which React updates the DOM when your app’s data changes. React doesn’t rebuild the entire webpage — instead, it: 1️⃣ Creates a new Virtual DOM copy. 2️⃣ Compares it with the previous Virtual DOM. 3️⃣ Updates only the parts that actually changed in the Real DOM. ✅ Goal: To make UI updates fast, efficient, and smooth. ⚙️ How It Works (Step-by-Step) 1️⃣ You update a component’s state or props. 2️⃣ React re-renders the Virtual DOM for that component. 3️⃣ React compares the new Virtual DOM with the previous one using the Diffing Algorithm. 4️⃣ Only the changed parts are updated in the Real DOM. 🧠 What is the Diffing Algorithm? The Diffing Algorithm is React’s smart method to detect changes between two Virtual DOMs efficiently. React assumes: Elements with different types (like <div> → <p>) are completely different → replace the whole node. Elements with the same type (like <div> → <div>) → only update changed attributes or children. Keys help React identify which elements changed, added, or removed in lists. What is JSX? JSX (JavaScript XML) is a syntax extension for JavaScript used in React. It allows us to write HTML-like code inside JavaScript — making UI creation simple and readable. Why We Use JSX 1️⃣ Cleaner Code: Easier to read and write than React.createElement() 2️⃣ Dynamic UI: You can use JS expressions directly inside JSX 3️⃣ Component Friendly: JSX makes building reusable UI components simpler #React #ReactJS #LearnReact #ReactDeveloper #ReactLearning #ReactJourney #ReactSeries #ReactTips #ReactBeginners #ReactForBeginners #ReactCommunity
To view or add a comment, sign in
-
🔥 React isn’t “just a JavaScript library.” It forces you to think differently. When most people start learning, it feels easy at first: “Components, props, hooks… done.” Then suddenly the code gets messy, bugs appear everywhere, and nothing feels predictable. The difference usually isn’t experience — it’s missing fundamentals. Here are the concepts that make React development actually make sense 👇 ✅ 1. Components = Reusable UI pieces Break the UI into smaller parts instead of building one giant file. Buttons, cards, navbars… smaller pieces → cleaner projects. ✅ 2. Props = Data going down Parents send data to children. No props → no communication. Clear props = fewer surprises. ✅ 3. State = What makes apps “interactive” When state changes, UI updates. Click a button, type something, fetch data — React reacts only because of state. ✅ 4. Virtual DOM = Efficient updates Instead of repainting everything, React updates only what changed. That’s why it feels fast. ✅ 5. Hooks = Logic without chaos useState → store data useEffect → side effects / API calls useRef → access DOM elements useContext → avoid prop drilling useMemo / useCallback → optimize performance ✅ 6. One-Way Data Flow Data moves down the component tree, not randomly in every direction. Predictable → easier debugging. At the end of the day, React isn’t about memorizing libraries. It’s about understanding state, data flow, and reusable components. Master these, and everything else starts to feel much simpler. Follow Lakshya Gupta for more #ReactJS #WebDevelopment #JavaScript #Frontend #Programming #ReactHooks #MERN #FullStack #DeveloperTips #CodeNewbies #BuildInPublic #LeaningEveryday
To view or add a comment, sign in
-
-
Understanding the Event Loop in JavaScript Have you ever wondered how JavaScript handles multiple tasks — like fetching data, responding to user clicks, or updating the UI — without freezing your app? 🤔 That’s where the Event Loop comes in! 🔁 🧠 What is the Event Loop? JavaScript is single-threaded, meaning it executes one line at a time. But thanks to the Event Loop, JavaScript can handle asynchronous tasks (like setTimeout, API calls, or Promises) efficiently without blocking the main thread. 🕹️ How it works (simple flow): 1️⃣ All synchronous code goes to the Call Stack. 2️⃣ Asynchronous code (like callbacks or promises) moves to the Web APIs. 3️⃣ When ready, those tasks go to the Callback Queue (or Microtask Queue for Promises). 4️⃣ The Event Loop constantly checks if the Call Stack is empty — if yes, it pushes tasks from the queue to the stack. ✅ Result: JavaScript appears to do multiple things at once — but smartly! 💡 Tip: Understanding the Event Loop helps you write non-blocking, high-performance JavaScript — a must-have skill for frontend and backend developers alike. --- 🚀 Want to master such core concepts hands-on? Join Coding Block Hisar’s JavaScript & Full Stack Training — learn from projects, not just theory! #JavaScript #WebDevelopment #CodingBlockHisar #FullStackDevelopment #EventLoop #AsyncProgramming #FrontendDevelopment #ProgrammingTips #Hisar
To view or add a comment, sign in
-
-
I'm experimenting with a web stack that might ship 75% less JavaScript 💻 After watching bundle sizes creep up project after project, I'm trying something different: Bun + Astro + MongoDB + HTMX + Alpine Here's the hypothesis: Astro renders HTML on the server. Fast builds, zero JS by default. HTMX handles dynamic interactions without writing API endpoints. Click a button, get HTML back, swap it in. Alpine sprinkles in client-side reactivity where needed (dropdowns, modals, form validation). It's 15KB. Bun makes everything faster. Install, test, run - all measurably quicker than Node. MongoDB because sometimes you just want flexible schemas and good DX. Why I'm curious about this 🤔 Modern React/Next.js apps easily hit 200-300KB of JavaScript. This stack should land around 35-50KB for most use cases. That's not just a smaller number - it's faster page loads, especially on mobile. What I'm testing it for 🧪 - Content-heavy sites and blogs - Internal dashboards and admin panels - CRUD applications - Projects where you want to ship fast without complexity Not trying to replace React for complex SPAs. Different tools for different jobs. The questions I'm exploring ⁉️ - Does the HTMX mental model feel natural after years of React? - Where does Alpine fall short compared to Vue/React? - Is Bun mature enough for production? - What's the developer experience really like? I'll be documenting what I learn. If you've used any of these tools, I'd love to hear your experience. Are we over-engineering web development? Or do modern frameworks earn their complexity? #WebDevelopment #JavaScript #HTMX #Astro #DeveloperExperience
To view or add a comment, sign in
-
🚀 The JavaScript Roadmap..... 💡 When I first heard “JavaScript,” I thought it was just about making buttons click or changing colors on a page. But once I really got into it — I realized JavaScript is the heart of the modern web. ❤️ If you’re starting your JavaScript journey, here’s a roadmap I wish someone had shown me 👇 ✨ 1️⃣ The Core Foundation Before diving into frameworks, get the basics right. Understand how JavaScript actually thinks. Learn: ✔ Variables (var, let, const) ✔ Data Types & Type Conversion ✔ Operators ✔ Conditionals (if, else, switch) ✔ Loops & Iterations ✔ Functions (and arrow functions) ⚙️ 2️⃣ Dig Into the Essentials Once you’re comfortable, explore what makes JS so powerful. ✔ Arrays & Objects ✔ Scope & Hoisting ✔ Callbacks ✔ DOM Manipulation ✔ Events & Event Listeners ✔ JSON 🧠 3️⃣ The Advanced Mindset Now it’s time to think like JavaScript. These concepts separate coders from developers 👇 ✔ Closures ✔ Asynchronous JS (Promises, async/await) ✔ The Event Loop ✔ Modules & Import/Export ✔ Error Handling ✔ LocalStorage & SessionStorage 💻 4️⃣ The Practical Side Start building things! You’ll never understand JS deeply until you apply it. ✅ Mini Projects: • To-Do List • Quiz App • Weather App • Calculator • API-based Project ⚡ 5️⃣ The Modern Ecosystem Once your core is strong, move to frameworks & libraries: • React / Vue / Angular • Node.js for backend • Express.js for APIs • MongoDB for data handling That’s where you’ll see JavaScript come alive — from frontend to backend. 🌍 💬 Final Thought: JavaScript isn’t just a language — it’s the bridge between ideas and interactivity. Mastering it takes patience, practice, and curiosity. So start small, stay consistent, and keep experimenting. Because once you “get” JavaScript, you don’t just build websites — you build experiences. ✨ #JavaScript #WebDevelopment #CodingJourney #Frontend #Backend #FullStack #Programming #Developers #TechLearning #CareerGrowth #Mindset Bhargav Seelam Spandana Chowdary 10000 Coders Sudheer Velpula Prem Kumar Ponnada
To view or add a comment, sign in
-
React Best Practices for Folder Structure & System Design Good structure means fewer headaches Most beginners worry about JSX or hooks, but the real chaos starts with folders. If your src/ looks like this 👇 components/ pages/ hooks/ utils/ …it’ll crumble the moment your app grows. ✅ Think in features, not files. Structure it like this instead: 👇 src/ features/ auth/ components/ hooks/ api/ dashboard/ components/ hooks/ api/ shared/ components/ hooks/ utils/ ✅ All related logic stays together, easier to debug, test, and scale. 🔹Use a shared/ folder for reusable stuff (buttons, modals, helper functions). 🔹Keep naming consistent: Use PascalCase for components → UserProfile.jsx Use camelCase for hooks and utils → useAuth.js, formatDate.js 🔹Think in layers: (Just like backend, frontend has layers) UI Layer → Components (presentational) State Management Layer → React Context / Redux / Zustand Data Layer → API calls (Axios, fetch, React Query) Utilities Layer → Shared helpers Best practice: keep each layer decoupled. For example, don’t put API logic directly in components. A clean structure isn’t about being “tidy.” It’s about designing your frontend like a system: scalable, testable, and developer-friendly. Write code your future self won’t hate.😉 #React #FrontendArchitecture #WebDevelopment
To view or add a comment, sign in
-
-
React Best Practices for Folder Structure & System Design Good structure means fewer headaches Most beginners worry about JSX or hooks, but the real chaos starts with folders. If your src/ looks like this 👇 components/ pages/ hooks/ utils/ …it’ll crumble the moment your app grows. ✅ Think in features, not files. Structure it like this instead: 👇 src/ features/ auth/ components/ hooks/ api/ dashboard/ components/ hooks/ api/ shared/ components/ hooks/ utils/ ✅ All related logic stays together, easier to debug, test, and scale. 🔹Use a shared/ folder for reusable stuff (buttons, modals, helper functions). 🔹Keep naming consistent: Use PascalCase for components → UserProfile.jsx Use camelCase for hooks and utils → useAuth.js, formatDate.js 🔹Think in layers: (Just like backend, frontend has layers) UI Layer → Components (presentational) State Management Layer → React Context / Redux / Zustand Data Layer → API calls (Axios, fetch, React Query) Utilities Layer → Shared helpers Best practice: keep each layer decoupled. For example, don’t put API logic directly in components. A clean structure isn’t about being “tidy.” It’s about designing your frontend like a system: scalable, testable, and developer-friendly. Write code your future self won’t hate.😉 #React #FrontendArchitecture #WebDevelopment
To view or add a comment, sign in
-
-
React Best Practices for Folder Structure & System Design Good structure means fewer headaches Most beginners worry about JSX or hooks, but the real chaos starts with folders. If your src/ looks like this 👇 components/ pages/ hooks/ utils/ …it’ll crumble the moment your app grows. ✅ Think in features, not files. Structure it like this instead: 👇 src/ features/ auth/ components/ hooks/ api/ dashboard/ components/ hooks/ api/ shared/ components/ hooks/ utils/ ✅ All related logic stays together, easier to debug, test, and scale. 🔹Use a shared/ folder for reusable stuff (buttons, modals, helper functions). 🔹Keep naming consistent: Use PascalCase for components → UserProfile.jsx Use camelCase for hooks and utils → useAuth.js, formatDate.js 🔹Think in layers: (Just like backend, frontend has layers) UI Layer → Components (presentational) State Management Layer → React Context / Redux / Zustand Data Layer → API calls (Axios, fetch, React Query) Utilities Layer → Shared helpers Best practice: keep each layer decoupled. For example, don’t put API logic directly in components. A clean structure isn’t about being “tidy.” It’s about designing your frontend like a system: scalable, testable, and developer-friendly. Write code your future self won’t hate.😉 #React #FrontendArchitecture #WebDevelopment
To view or add a comment, sign in
-
-
🚀 Learn React Faster — by Understanding JavaScript the Right Way Most people rush into React hoping to “learn it in 30 days.” But the real secret to mastering React isn’t learning JSX or hooks — it’s understanding how JavaScript itself structures software. That’s exactly what I focused on through my latest mini-project 👇 🎯 Project: Money Tracker App (Live Demo) 🧩 Tech Used: HTML, CSS, Materialize, and Plain JavaScript (ES6) 🏗️ Architecture: MVC — Model, View, Controller By building this app purely in vanilla JavaScript with the MVC pattern, I learned how: Each layer (Model, View, Controller) has its clear purpose Data flow and UI logic stay clean and maintainable Understanding state, DOM updates, and component logic directly translates to React’s mindset This experience made React concepts — like component hierarchy, state management, and data flow — feel natural instead of confusing. 💡 My takeaway: If you can build a small project in pure JS following the MVC architecture, you’ll be able to learn React (or any modern JS framework) in half the time — and with a stronger software-development foundation. 📚 Project goal: Not just to track expenses, but to track understanding. 👨💻 Check it out here: 🔗 App link: https://lnkd.in/eY9MUKzm 🔗 GitHub Repository: https://lnkd.in/es5BnFNc #JavaScript #ReactJS #WebDevelopment #LearningJourney #MVC #SoftwareEngineering #BCA #FrontendDevelopment
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development