spent an hour debugging a laggy FlatList last week before i realized i'd been making the same mistake for months i was passing an inline arrow function to renderItem. looks fine. works fine in small lists. absolutely kills performance when the list grows because every parent re-render creates a new function reference and React thinks every single item changed. fixed it with useCallback in like 2 minutes. list went smooth instantly. not sharing this because it's groundbreaking. sharing it because i've seen this exact thing in three different codebases this year and nobody noticed until the list hit 100+ items. if your FlatList feels sluggish and you can't figure out why - check your renderItem first. might save you an hour. #ReactNative #MobileDev #JavaScript
Fixing FlatList Lag with useCallback in React Native
More Relevant Posts
-
🚀 Day 29 - 💡 JavaScript Tricky Question Explanation let a = [1,2,3]; delete a[1]; console.log(a); console.log(a.length); 👉 Output: ``` [1, empty, 3] 3 ``` 👉 Explanation: * `delete` removes the value but does NOT reindex the array * It creates a hole (empty slot) instead of shifting elements * So, `length` remains 3 ⚠️ Use `splice()` if you want to remove and shift elements #JavaScript #WebDevelopment #Frontend #CodingInterview #JSConcepts
To view or add a comment, sign in
-
⚠️ Part 2 of 10: I think `useEffect` gets overused. A lot. I get why. Something changes. You want something else to update. `useEffect` feels like the move. But a lot of React complexity starts right there. State changes. Effect runs. Another state changes. Now you're tracing logic across multiple places for something that maybe could’ve been calculated directly. Once I started asking: “Is this syncing with something external?” instead of “How do I make this run after render?” my code got a lot easier to follow. That one shift cleaned up a lot for me. What’s your most overused React habit? #React #useEffect #ReactHooks #FrontendDevelopment #JavaScript #TypeScript #CleanCode
To view or add a comment, sign in
-
🌳 Ever wondered how the DOM Garden grows? JavaScript is the gardener! ✂️ element.remove() → Prune dead branches 🌱 element.appendChild() → Plant new leaves 🌿 innerHTML / textContent → Water the content 🎨 classList.add() → Add magical glow The DOM is a living tree — and you control every branch. #WebDev #JavaScript #DOM #Coding #Frontend
To view or add a comment, sign in
-
-
💡 JavaScript Tricky Question let a = 'hello'; a[0] = 'H'; console.log(a); 👉 Output: `hello` ✅ Explanation: Strings in JavaScript are **immutable** (cannot be changed). Even though it looks like we’re modifying `a[0]`, JavaScript ignores it. So the original string stays the same. 🔹 To change it, you must create a new string: a = 'H' + a.slice(1); #JavaScript #WebDevelopment #Frontend #Coding #JSConcepts
To view or add a comment, sign in
-
🧠 Day 10 of 21days challenge JavaScript call, apply, bind 🔥 They allow you to control what “this” refers to in a function. You can borrow functions and use them with different objects. For easy understanding :- call → pass arguments one by one apply → pass arguments as array bind → returns new function 👉 That’s how we control “this” in JavaScript This changed how I understand functions 🚀 #JavaScript #CallApplyBind #Frontend
To view or add a comment, sign in
-
-
DAY 14 — The Dependency Array Is a Contract THE DEPENDENCY ARRAY IS A CONTRACT Lying to useEffect's dependency array is one of the most common React mistakes. The eslint-plugin-react-hooks rule exists for a reason. If you omit a variable from the deps array, your effect runs with a stale closure. If you include everything correctly, the effect re-runs when any dep changes. The temptation is to add [] to "run once" — but if your effect uses state or props, you're creating a silent bug. The real fix is to rethink the effect's structure, not silence the linter. Empty deps [] means "I swear this effect uses nothing from the component." If that's not true, you have a bug. How many times has the linter saved you from yourself? 👇 #useEffect #ReactHooks #BestPractices #JavaScript
To view or add a comment, sign in
-
-
Turned my ASCII text scramble hover effect into a full-screen playground. Radial waves that expand from the cursor and scramble chars. Added a GUI for you to play with. Fun experiment but not sure it's very useful, might as well read some Lovecraft while you're there. Vanilla JS kept under 10k (gzipped) and only dependency is lil-gui for the control panel. → CodePen link: https://lnkd.in/dHrq789e #creativecoding #javascript #codepen #frontend #vanillajs
To view or add a comment, sign in
-
🚀 💡 JavaScript Tricky Question Explanation const arr = [4, 10, 2, 8]; const result = arr.find(num => num > 5) + arr.findIndex(num => num > 5); console.log(result); 👉 Output: 11 👉 Explanation: * find() returns the first value > 5 → `10` * findIndex() returns its index → `1` * Final result → `10 + 1 = 11` ⚡ Both stop at the **first match** #JavaScript #WebDevelopment #Frontend #CodingInterview #JSConcepts
To view or add a comment, sign in
-
Scroll events giving you headaches? 😩 There's a better way. The Intersection Observer API lets you detect when elements enter the viewport — no scroll listeners, no layout thrashing, just clean and efficient JS. ⚡ I just published a full breakdown with real code examples, tips, and common mistakes to avoid. 🔧 Read it now 👉 hamidrazadev.com #javascript #webdev #frontend #learntocode #100daysofcode
To view or add a comment, sign in
-
-
🚀 Just built a simple yet fun game using HTML, CSS & JavaScript! It’s a Bat–Ball–Stump game where the user selects an option and the computer makes a random choice 🎮 👉 Rules are simple: Bat 🆚 Ball → User wins Ball 🆚 Stump → User wins Stump 🆚 Bat → User wins This project helped me understand: ✔️ DOM manipulation ✔️ Event handling ✔️ Logic building Small project, but a big step in my learning journey 💻✨ Would love your feedback! #WebDevelopment #JavaScript #CodingJourney #Projects #FrontendDeveloper
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