Practicing React & JavaScript ✍ Built a simple shopping UI where I used: .map() to render products dynamically .filter() to handle category selection Starting to understand how real apps manage and display data. Next: improving cart functionality. #React #JavaScript #Frontend
Kelvin Maina’s Post
More Relevant Posts
-
Day 26 #100DaysOfCode 💻 Today I learned about Function, Component, State & Event in Next.js. 🔹 Function Functions are reusable blocks of code used to perform specific tasks. 🔹 Component In Next.js, everything is a component. It helps to break UI into reusable pieces. 🔹 State State is used to store dynamic data inside a component and re-render UI when data changes. 🔹 Event Events handle user interactions like clicks, input, form submission, etc. 💻 Code Snippet: "use client"; import { useState } from "react"; export default function Counter() { const [count, setCount] = useState(0); const handleClick = () => { setCount(count + 1); }; return ( <div> <h2>Count: {count}</h2> <button onClick={handleClick}>Increase</button> </div> ); } 🚀 Small reflection: Understanding these core concepts makes building dynamic and interactive apps much easier. #NextJS #ReactJS #WebDevelopment #JavaScript #Frontend #CodingJourney #Akbiplob
To view or add a comment, sign in
-
Next.js feels complicated for one reason You’re shipping too much to the browser. That’s it. Next.js is server-first. React is client-first. Mix them wrong → everything breaks (performance, bundle size, clarity). The rule: If it doesn’t need clicks → keep it on the server If it needs interaction → move it to the client And yet most devs do this: - "use client" - "use client" - "use client" Congrats — you just turned Next.js back into React. Real example: Dashboard page: Data, layout, rendering → Server Search, filters, UI state → Client That split alone can cut your JS by a lot. Next.js isn’t complex. You’re just using it like it’s not Next.js. #NextJS #React #WebPerf #Frontend #JavaScript #BuildInPublic
To view or add a comment, sign in
-
🚀 Debounce vs Throttle in React (and when to use each) Handling user interactions efficiently is key to building performant applications — especially when dealing with frequent events like typing and scrolling. Here’s a simple breakdown: 🔹 Debounce • Delays execution until the user stops triggering the event • Best for: search inputs, API calls on typing 🔹 Throttle • Limits execution to once every fixed interval • Best for: scroll events, resize handlers ⚠️ Without control, frequent events can lead to: • Too many API calls • UI lag • Performance issues 📈 Results: • Reduced unnecessary API requests • Improved UI responsiveness • Better user experience 💡 Key takeaway: Use debounce when you want the final action, use throttle when you want continuous control. What scenarios have you used debounce or throttle in? #React #Frontend #WebDevelopment #Performance #JavaScript #NextJS
To view or add a comment, sign in
-
-
Built a to-do app with a glassmorphic UI as a mini project. Kept it simple — vanilla HTML, CSS, and JS. No frameworks. A few things I learned along the way: — Local Storage API to persist tasks on refresh — DOM manipulation with vanilla JS — How CSS backdrop-filter actually works for the glass effect — JSON.stringify and JSON.parse for saving arrays Small project but learned a lot from it. More coming. repo link: https://lnkd.in/dEtj35Us #WebDev #JavaScript #Frontend #BuildInPublic
To view or add a comment, sign in
-
-
Your UI lag is not always React. Sometimes… It’s the JavaScript event loop. Here’s what’s happening 👇 JavaScript is single-threaded. So when you run: → Heavy calculations → Large loops → Sync blocking code You block: ❌ Rendering ❌ User interactions Result: → UI freezes → Clicks feel delayed → App feels slow React can’t help here. Because it runs on the same thread. What works: ✔ Break work into chunks ✔ Use requestIdleCallback / setTimeout ✔ Offload heavy tasks (Web Workers) Key insight: Performance is not just “React optimization”. It’s understanding how the browser executes code. Ignore the event loop… And your UI will suffer. #JavaScript #EventLoop #Frontend #ReactJS #Performance #SoftwareEngineering #WebDevelopment #AdvancedReact #Engineering #Optimization
To view or add a comment, sign in
-
Ever wonder how to get React’s power without the heavy payload? Enter Preact. ⚛️ What is Preact? It’s a fast, ultra-lightweight (3kB) JavaScript library with the exact same modern API as React. You get the Virtual DOM, components, and hooks you already know—just without the bulk. When should you use it? 🚀 Performance-critical apps: Drastically faster load times and lower memory usage. 📱 Mobile Web & PWAs: Perfect for shipping minimal code to devices on slower networks. 🏝️ Islands Architecture: The go-to choice for frameworks like Astro or Fresh where keeping client-side JS tiny is the goal. React vs. Preact: The TL;DR Size: React sits around ~40kB; Preact is roughly ~3kB. DOM Proximity: Preact drops React's Synthetic Events in favor of standard DOM events, and lets you use standard HTML attributes (like class instead of className). The Best Part: Thanks to the preact/compat layer, you can swap React for Preact in your bundler and continue using your favorite React libraries without rewriting your code. If frontend performance is your priority, Preact is a massive win. Have you tried using Preact in any of your projects yet? Let me know below! 👇 https://preactjs.com/ #Preact #ReactJS #WebDevelopment #Frontend #JavaScript #WebPerformance
To view or add a comment, sign in
-
-
Want to make your React/Next.js code cleaner and more maintainable? 🤔 Custom hooks are your secret weapon! They let you extract component logic into reusable functions, keeping your components focused on rendering UI. Think about it: - **Reusability:** Write logic once, use it anywhere. - **Readability:** Components become shorter and easier to understand. - **Testability:** Isolate and test your logic independently. This is a game-changer for managing complex applications. What's your favorite custom hook pattern? #ReactJS #NextJS #JavaScript #WebDevelopment #CustomHooks #CodingTips
To view or add a comment, sign in
-
-
🚀 New Open Source React + Tailwind CSS v4 UI Library Building UI with Tailwind still feels repetitive? I built something to fix that 👇 Excited to share my new open-source project: Ninna UI • 69+ ready-to-use components • 12 tree-shakeable packages • Built with Tailwind CSS v4 - zero JS configuration • Fully accessible components • Zero-runtime theming • 8 semantic colors (OKLCH + WCAG AA) • 98 data-slot attributes for precise styling • Automatic dark mode Built to remove boilerplate and give full control over styling without runtime overhead. 🌐Docs: https://www.ninna-ui.dev/ ⭐GitHub: https://lnkd.in/dRe5wW7P Star the repo to support the project What do you think about zero-runtime theming? #reactjs #tailwindcss #opensource #webdev #frontend #ui #javascript
To view or add a comment, sign in
-
-
𝐓𝐡𝐢𝐧𝐤𝐢𝐧𝐠 `React.memo` 𝐦𝐚𝐤𝐞𝐬 𝐲𝐨𝐮𝐫 𝐜𝐨𝐦𝐩𝐨𝐧𝐞𝐧𝐭𝐬 𝐩𝐞𝐫𝐟𝐞𝐜𝐭𝐥𝐲 𝐩𝐞𝐫𝐟𝐨𝐫𝐦𝐚𝐧𝐭? 𝐓𝐡𝐢𝐧𝐤 𝐚𝐠𝐚𝐢𝐧. Many of us reach for `React.memo` to prevent unnecessary re-renders in child components. And it works wonders... most of the time. But here's the catch: `React.memo` performs a shallow comparison of props. If you're passing object, array, or function props, even if their internal values haven't changed, a new reference is created on every parent re-render. This new reference makes `React.memo` think the prop has changed, leading to an unwanted re-render of your memoized child component. ```javascript // Parent component re-renders: const data = { id: 1, name: 'Item' }; // New object reference! <MemoizedChild item={data} /> // Or with a function: const handleClick = () => console.log('clicked'); // New function reference! <MemoizedChild onClick={handleClick} /> ``` The solution? Pair `React.memo` with `useCallback` for functions and `useMemo` for objects/arrays. ```javascript // In Parent component: const memoizedData = useMemo(() => ({ id: 1, name: 'Item' }), []); const memoizedHandleClick = useCallback(() => console.log('clicked'), []); <MemoizedChild item={memoizedData} onClick={memoizedHandleClick} /> ``` This ensures your props maintain the same reference across renders, allowing `React.memo` to truly shine. It's a small detail, but crucial for optimizing complex applications. How aggressively do you memoize in your React apps? Share your go-to strategies! #React #ReactJS #FrontendDevelopment #WebPerformance #JavaScript
To view or add a comment, sign in
-
🚀 React Re-rendering — Key Concepts Re-rendering is the core of how React keeps UI in sync with data. Without it, there would be no interactivity in our applications. Here are some important insights I've learned: 🔹 State updates are the primary trigger for re-renders 🔹 When a component re-renders, all its child components re-render by default 🔹 Even without props, components still re-render during the normal render cycle (without use of memoization). 🔹 Updating state in a hook triggers a re-render, even if that state isn’t directly used 🔹 In chained hooks, any state update will re-render the component using the top-level hook 🔹 “Moving state down” is a powerful pattern to reduce unnecessary re-renders in large applications #ReactJS #FrontendDevelopment #WebDevelopment #JavaScript #SoftwareEngineering #LearningInPublic
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