Props vs State ⚔️ 🔹 Props 📥 ✔ Passed from parent component ✔ Read-only (immutable) ✔ Used for communication 🔹 State 📦 ✔ Managed inside component ✔ Can be updated ✔ Controls dynamic behavior 🔹 Key Difference 🧠 📥 Props = External Data 📦 State = Internal Data 🔹 When to Use? 👉 Props → Send data between components 👉 State → Handle user interaction & changes #ReactJS #PropsVsState #FrontendDev #JavaScript
React Props vs State: Key Differences
More Relevant Posts
-
Worked on a few small projects while learning JavaScript in the browser. Focused mainly on: • DOM manipulation • forms and validation • timers (setTimeout, setInterval) • localStorage Nothing complex, but enough to understand how things actually behave. Handling user input, updating the UI, storing data - all of it made JavaScript feel more practical. These small projects helped connect multiple concepts together instead of learning them in isolation. #javascript #webdevelopment #frontend
To view or add a comment, sign in
-
𝐄𝐱𝐭 𝐉𝐒 𝟖.𝟎 𝐚𝐝𝐝𝐬 𝐜𝐚𝐩𝐚𝐛𝐢𝐥𝐢𝐭𝐢𝐞𝐬 𝐝𝐞𝐯𝐞𝐥𝐨𝐩𝐞𝐫𝐬 𝐩𝐫𝐞𝐯𝐢𝐨𝐮𝐬𝐥𝐲 𝐡𝐚𝐝 𝐭𝐨 𝐛𝐮𝐢𝐥𝐝 𝐭𝐡𝐞𝐦𝐬𝐞𝐥𝐯𝐞𝐬. Here's the full picture. 👉 This release covers both the Modern and Classic toolkits with targeted improvements across four categories: Core additions that work across both toolkits: → Digital Signature component → QR Code Reader & Generator → Font Awesome 7 as default → Updated ECMAScript compiler support Modern toolkit upgrades: → Lockable Grid plugin → Horizontal Buffered Rendering → Dialog Boundary Control → Improved ARIA support Classic toolkit: → Tri-State TreePanel Checkboxes Swipe through for each one in detail. 𝐓𝐫𝐲 𝐄𝐱𝐭 𝐉𝐒 𝐅𝐫𝐞𝐞 𝐟𝐨𝐫 𝟑𝟎 𝐃𝐚𝐲𝐬 👇 https://lnkd.in/gK8FhY_h #ExtJS #JavaScript #FrontendEngineering #WebDevelopment #EnterpriseUI
To view or add a comment, sign in
-
Day 6 — Find Second Largest Number in an Array (JavaScript) Problem Write a function to find the second largest number in an array. Example Input: [10, 5, 8, 20] Output: 10 Approach First find the largest number, then find the largest number smaller than it. Code function secondLargest(arr){ let largest = -Infinity let second = -Infinity for(let i = 0; i < arr.length; i++){ if(arr[i] > largest){ second = largest largest = arr[i] } else if(arr[i] > second && arr[i] !== largest){ second = arr[i] } } return second } console.log(secondLargest([10,5,8,20])) Alternative Approach function secondLargest(arr){ let sorted = [...new Set(arr)].sort((a,b) => b-a) return sorted[1] } What I Learned How to track two maximum values in a single loop. #javascript #frontenddeveloper #codingpractice #webdevelopment
To view or add a comment, sign in
-
-
useEffect is probably the most powerful - and most misused - hook in React. 🎯 Arun explained it really well, sharing this because I've made these exact mistakes in real projects: → Forgetting the cleanup function - memory leaks in production 😅 → Wrong dependency array - stale data showing up in dashboards → Fetching data inside useEffect - unnecessary re-renders and race conditions What changed for me: ✅ Always write cleanup for subscriptions and event listeners ✅ Use React Query for data fetching — avoids most useEffect complexity ✅ Think twice before adding objects/arrays as dependencies 2.5 years of React and useEffect still teaches me something new. What's your most common useEffect mistake? Drop it below 👇 #ReactJS #Frontend #JavaScript #WebDevelopment #FrontendDeveloper
Software Engineer | 3 years experience in Full Stack Web Development | React.js | JavaScript | Redux | Node.js | Express.js | Building Scalable & Performant Web Applications
⚛️ React Concept: useEffect Explained Simply The "useEffect" hook lets you handle side effects in functional components — like API calls, subscriptions, and DOM updates. 🔹 It runs after the component renders 🔹 You can control when it runs using the dependency array Basic syntax: useEffect(() => { // side effect logic return () => { // cleanup logic (optional) }; }, [dependencies]); 📌 Common use cases: • Fetching data from APIs • Adding event listeners • Handling timers 📌 Best Practice: Always define dependencies correctly and use cleanup functions to avoid memory leaks. #reactjs #frontenddevelopment #javascript #webdevelopment #softwareengineering
To view or add a comment, sign in
-
-
Built a few small projects focused on event handling in JavaScript. Worked with: • event bubbling and capturing • keyboard input display • mouse hover interactions • form submit handling • file upload button behavior • live character counter Most of these were simple individually, but together they gave a clearer understanding of how events actually flow and how the UI responds to user actions. This was less about writing logic, and more about handling interaction properly. #javascript #webdevelopment #frontend #events
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
-
🧠 Day 18 of 21days challenge JavaScript WeakMap ⚡ WeakMap is a collection where keys must be objects. It helps in memory management because keys are weakly referenced. For easy understanding :- WeakMap = object keys only Garbage collected if no other references Useful to store private data 👉 That’s how memory leaks can be prevented This changed how I manage objects efficiently 🚀 #JavaScript #WeakMap #InterviewPrep #Frontend
To view or add a comment, sign in
-
-
Ever seen: “Warning: Text content did not match. Server: … Client: …” That’s hydration mismatch. Server-rendered HTML doesn’t match what React renders on the client. Common causes: Using window/document directly Client-only conditional rendering DOM-manipulating libraries Tip: Use useEffect or dynamic imports (ssr: false) for client-only code. Hydration issues are subtle—but they can break your UI in production! #NextJS #ReactJS #WebDevelopment #Frontend #JavaScript #Programming #TechTips #WebDev
To view or add a comment, sign in
-
-
⚛️ React Concept: useState Explained with Real Examples The "useState" hook allows you to add state management to functional components. It helps you store and update data that changes over time — like user input, counters, or UI state. Basic syntax: const [state, setState] = useState(initialValue); 🔹 "state" → current value 🔹 "setState" → function to update the value 📌 Common use cases: • Counter functionality • Form inputs • Toggle UI (show/hide) 📌 Best Practice: Always update state using the setter function and avoid directly mutating state. #reactjs #frontenddevelopment #javascript #webdevelopment #softwareengineering
To view or add a comment, sign in
-
-
Development to Deployment: VS Code workflow made easy! Just a small thing built for fun while exploring tools. Logic Game: The Target Sum Challenge 🧩 Try the live tool here!👇 https://lnkd.in/dCuz7Uxa #GameDev #JavaScript #CodingFun #WebDevelopment #MentalMath #PuzzleGame #VSCode #LogicPuzzles #TechInnovation #Frontend
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