Lately I’ve been learning React Router (the declarative way), and it finally started making sense. At first, routing felt a bit “extra” like something separate from React. But with the declarative approach, it actually feels like part of the UI. You just describe your routes… and it works. What clicked for me: • You don’t “control” navigation step-by-step • You define routes like components • Nested routes make layouts feel natural • Params/dynamic routes are way simpler than I expected It’s not magic but it does remove a lot of unnecessary thinking. Still exploring it, but definitely one of those concepts that feels obvious after you get it. #React #JavaScript #Frontend #WebDevelopment #LearningInPublic
Mastering React Router: Declarative Approach Simplifies Navigation
More Relevant Posts
-
A small mistake I used to make in React: Re-rendering components more than needed. At first, I didn’t think much about it — everything was “working fine.” But as components grew, I started noticing: • Unnecessary re-renders • Slower UI updates • Harder debugging What helped me improve: • Using React.memo for pure components • Avoiding inline functions/objects where not needed • Proper use of useCallback and useMemo • Avoiding unnecessary useEffect usage • Managing dependency arrays correctly • Keeping state as minimal as possible Big learning: 👉 Just because it works doesn’t mean it’s efficient. Performance issues often come from small habits, not big mistakes. Still learning, but being mindful of re-renders and side effects has made a noticeable difference. What’s one React mistake you fixed that improved performance? #reactjs #javascript #webdevelopment #frontend #fullstackdeveloper
To view or add a comment, sign in
-
-
useState looks simple, but it teaches one of the most important ideas in React: UI is a function of state. The moment you stop manually changing the DOM and start updating state instead, React starts to make a lot more sense. useState is usually the first hook people learn, but it is also the one that shapes how you think about component design: - what data changes - what triggers re-renders - what should stay local - what should move higher up Simple API, big mindset shift. Good React code starts with good state decisions. #reactjs #javascript #frontend #webdevelopment
To view or add a comment, sign in
-
🚀 Day 3 – Props in React Props (short for properties) are used to pass data from one component to another in React. 🔹 Props are passed from parent to child components 🔹 They are read-only (cannot be modified) 🔹 Help in making components reusable and dynamic Example use: Passing data like name, price, or title to display different content in components. Props play an important role in building structured and maintainable React applications. #ReactJS #Props #Frontend #WebDevelopment #Learning
To view or add a comment, sign in
-
I made React slower trying to optimize it. Wrapped everything in useMemo. Added useCallback everywhere. Felt productive. Performance got worse. Here's what I didn't understand about re-renders 👇 4 things that trigger a re-render: > State change > Prop change > Parent re-renders (even if YOUR props didn't change) > Context update That third one is responsible of unnecessary re-renders I've seen in real codebases. The fix isn't memorizing APIs. It's this order: 1. Profile first Open React DevTools Profiler. Find the actual problem. Takes 2 minutes. 2. Wrap the right components in React.memo Not all of them. Only components that are expensive AND receive stable props. 3. Stabilise your functions with useCallback Without it - new function reference every render --> child always re-renders. Doesn't matter if you have React.memo. 4. useMemo for heavy calculations only Not for "this array map looks expensive." Only when Profiler proves it. The rule I follow now: Don't optimise what you haven't measured. One change in the right place beats 10 changes in the wrong ones. What's the most unnecessary useMemo you've ever written? 😄 #React #JavaScript #Frontend #WebDev
To view or add a comment, sign in
-
Mastering React Hooks made my frontend journey 10x easier 🚀 Here’s a simple breakdown 👇 🔹 State Management Hooks: • useState → manage simple state • useReducer → handle complex logic • useContext → share data globally 🔹 Side Effect Hooks: • useEffect → API calls, lifecycle tasks • useCallback → optimize functions • useMemo → improve performance 👉 If you understand these hooks, you can build powerful React apps easily. Which React Hook do you use the most? 🤔 #reactjs #frontend #webdevelopment #javascript #coding
To view or add a comment, sign in
-
-
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
-
I learnt a lot doing this project. Understood the use of React like never before and how certain features are utilized. Features: -> Drag-and-drop tasks across the Todo, Working, Completed columns using a React Library -> Add, edit, and view tasks with modals -> State management using React Context -> Persistent tasks with localStorage -> Learned advanced React hooks, context, and dynamic UI handling This project helped me level up my React skills and understand interactive, state-driven UIs. React Todo Website: https://lnkd.in/eXKm3Hqn Check it out on GitHub: https://lnkd.in/exiv6Tpv #ReactJS #Frontend #WebDevelopment #UIUX #TodoApp #JavaScript
To view or add a comment, sign in
-
🚀 Starting a 10-part series on React things that make code harder than it needs to be. Not tutorials. Not “10 hooks you should know.” Just real patterns that show up in actual codebases and make simple work more annoying than it should be. Part 1: A lot of React problems are really state problems. Not React itself. Not JSX. Not even hooks most of the time. State living in too many places. Duplicated state. State doing jobs it was never supposed to do. That’s usually when an app starts feeling harder to reason about than it should. The more I work with React, the more I think good frontend code starts with good state decisions. If the state is messy, everything downstream gets harder: debugging feature work testing handoffs even basic collaboration Good React usually feels predictable. And predictable usually starts with state. What’s the most common state mistake you keep seeing? #React #ReactJS #StateManagement #FrontendEngineering #JavaScript #TypeScript #SoftwareEngineering
To view or add a comment, sign in
-
I'm going to talk about two things in it: Activity and useEffectEvent. Both were experimental for two-plus years. Both are now stable. Activity You know the drill with conditional rendering. Works fine until users complain that switching tabs clears their form. The component unmounts, state goes with it. Activity mode="hidden" keeps the component alive but out of sight. Effects get unmounted, so nothing runs in the background. Updates pause until React clears its queue. State stays. The mental model that clicked for me: you're parking the component, not deleting it. Tabbed UIs, back navigation that remembers scroll and input state, pre-loading a page while the user is still on another one — these all make sense now without reaching for manual state hoisting. useEffectEvent This one fixed something that's been annoying me for a long time. Say you have an effect that opens a WebSocket. When the connection is established, you show a notification. The notification reads from a theme prop. If you add theme to the dependency array, the socket reconnects every time the theme changes. If you leave it out, the linter is unhappy. useEffectEvent lets you pull the notification logic into a separate function. That function always reads the latest theme but doesn't count as a reactive dependency. The socket reconnects when the room changes. Not when the theme does. A few rules to know: don't put useEffectEvent functions in dependency arrays, don't call them during render, don't pass them to child components. They're not a general escape hatch. They're for logic that behaves like an event — something that fires from inside an effect but shouldn't control when that effect runs. What actually changed For me, both of these reduce the number of cases where the right answer was "hoist the state up" or "add an eslint-disable comment and move on." That's not nothing. #react #frontend #javascript #webdev #reactjs #frontenddevelopment #softwaredevelopment
To view or add a comment, sign in
-
-
🔥 I used to think React worked like this… 👉 “You change something… and the whole page re-renders.” That was my mental model for a long time. And honestly… it made React feel unpredictable. Then I learned what actually happens. ⚛️ React does NOT re-render everything When state changes, React does NOT rebuild the entire UI. Instead: It creates a new Virtual DOM snapshot Compares it with the previous one Detects ONLY what changed Updates just those parts in the real DOM 💡 So what’s actually happening? ❌ Not: “everything re-renders” ✔ But: “React calculates the difference and patches only what changed” 🧠 The mindset shift This changed how I write React code completely. Now I stop thinking in terms of: 👉 “What re-renders?” And start thinking: 👉 “What actually changes?” 🚀 Why this matters Because performance issues in React usually don’t come from React itself… They come from misunderstanding the rendering model. 🧩 Once this clicks, React stops feeling like magic and starts feeling like a system you can control. Have you ever had a React concept you used for months… before finally realizing how it actually works? #React #JavaScript #Frontend #WebDevelopment #CleanCode
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