DAY 19 OF POSTING REACT CONTENT ⚛️ WHAT DOES async REALLY DO? 🤔 When we add async before a function, we are telling JavaScript: 👉 “This function will return a Promise.” Even if we return a normal value, JavaScript automatically wraps it inside a Promise. So: async does not pause anything. It just prepares the function to work with asynchronous tasks. #ReactJS #JavaScript #AsyncJavaScript #Promises #FrontendDevelopment #LearnInPublic #WebDevelopment #CodingJourney
Understanding async in JavaScript with React
More Relevant Posts
-
😍Complete Guide to JavaScript Promises, Async/await and Promise Methods😍 𝗙𝗼𝗿 𝗺𝗼𝗿𝗲 𝘀𝘂𝗰𝗵 𝘂𝘀𝗲𝗳𝘂𝗹 𝗰𝗼𝗻𝘁𝗲𝗻𝘁, 𝗱𝗼𝗻'𝘁 𝗳𝗼𝗿𝗴𝗲𝘁 𝘁𝗼 𝗳𝗼𝗹𝗹𝗼𝘄 Muhammad Nouman 𝗺𝗲. #javascript #reactjs #nextjs #webdevelopment
To view or add a comment, sign in
-
DAY 22 OF POSTING REACT CONTENT ⚛️ WHAT ARE ES MODULES? 🤔 Modern JavaScript uses ES Modules to split code into separate files. Instead of writing everything in one file, we can: 👉 export something from one file 👉 import it into another file React heavily depends on ES Modules. Every component you create is usually exported and imported somewhere else. #ReactJS #JavaScript #ESModules #FrontendDevelopment #LearnInPublic #WebDevelopment #CodingJourney
To view or add a comment, sign in
-
-
💡How to access keys, values and key-value pairs from object in JavaScript💡 𝗙𝗼𝗿 𝗺𝗼𝗿𝗲 𝘀𝘂𝗰𝗵 𝘂𝘀𝗲𝗳𝘂𝗹 𝗰𝗼𝗻𝘁𝗲𝗻𝘁, 𝗱𝗼𝗻'𝘁 𝗳𝗼𝗿𝗴𝗲𝘁 𝘁𝗼 𝗳𝗼𝗹𝗹𝗼𝘄 𝗺𝗲. #javascript #reactjs #nextjs #webdevelopment
To view or add a comment, sign in
-
-
🚀 Mocking Dependencies in JavaScript Tests Mocking is a technique used in unit testing to isolate the code being tested from its dependencies. When a unit of code relies on external resources or other modules, mocking allows you to replace those dependencies with controlled substitutes. This ensures that the test focuses solely on the behavior of the unit under test, without being affected by the external factors. Frameworks like Jest provide built-in mocking capabilities using functions like `jest.fn()` and `jest.mock()`. Mocking helps to create predictable and reliable tests. #JavaScript #WebDev #Frontend #JS #professional #career #development
To view or add a comment, sign in
-
-
DAY 20 OF POSTING REACT CONTENT ⚛️ WHAT DOES await REALLY DO? 🤔 await tells JavaScript: 👉 “Wait here until the Promise finishes.” It pauses the function until the result is ready. Example: async function getData() { const data = await fetchData(); console.log(data); } The code waits for fetchData() before moving to the next line. Cleaner than .then() Easier to read Same result #ReactJS #JavaScript #AsyncAwait #Promises #FrontendDevelopment #LearnInPublic #WebDevelopment #CodingJourney
To view or add a comment, sign in
-
-
Most developers don’t write bad async JavaScript. They write confusing async JavaScript. The issue usually isn’t syntax. It’s the mental model. When you mix .then() with await, scatter error handling, and don’t understand execution flow, async code becomes hard to reason about. In this reel, I explain: How async/await actually works Why consistency matters more than preference How to structure async logic for readability A simple rule that instantly improves your code Clean async code reduces bugs, improves maintainability, and makes debugging significantly easier. If you're serious about writing production-level JavaScript, mastering async flow is non-negotiable. What’s the biggest async mistake you see developers make? #JavaScript #WebDevelopment #SoftwareEngineering #CleanCode #NodeJS
To view or add a comment, sign in
-
JavaScript be like: NaN = Not a Number typeof NaN = “number” Make it make sense 😄 Fun part? NaN is technically a numeric value in JavaScript — it represents an invalid number result (like 0/0). 🙃 And it gets better: NaN === NaN → false Only JavaScript can be this confident and confusing at the same time. #JavaScript #JS #DeveloperHumor #WebDevelopment
To view or add a comment, sign in
-
Day 16 I used to chase new frameworks every week. React today. Next.js tomorrow. React native next month. But here’s what I’m learning: The real edge is mastering the basics. ✔️ Clean HTML structure ✔️ Proper CSS layout (Flexbox & Grid) ✔️ JavaScript fundamentals ✔️ Understanding how APIs actually work Most developers don’t lack tools. They lack depth. The goal isn’t to know everything. The goal is to be so solid at the fundamentals that you can build anything. Today I revised core JavaScript concepts and focused on writing cleaner, simpler logic. No hype. Just reps. #FrontendDevelopment #JavaScript #WebDevelopment #BuildInPublic #SoftwareEngineering
To view or add a comment, sign in
-
One common issue in async JavaScript is repetitive try/catch blocks that make code messy and harder to maintain. A cleaner approach is the await-to pattern, which wraps promises and returns [error, data]. This keeps your async functions clean, readable, and easier to debug. ✅ No nested try/catch ✅ No swallowed errors ✅ Cleaner and reusable code ✅ Better error handling pattern Sometimes the best optimization is not adding more code — it’s removing repetition. What pattern do you use for handling async errors in your projects? #JavaScript #ReactNative #NodeJS #CleanCode #AsyncAwait #SoftwareDevelopment #WebDevelopment
To view or add a comment, sign in
-
-
🌐 Understanding JSX in React Today I learned how JSX allows us to write HTML inside JavaScript. 1)Embedding JavaScript inside {} 2)Single root element rule 3)How React converts JSX into JavaScript ✔ JSX = Syntactic sugar ✔ It gets compiled by Babel ✔ It becomes React.createElement() ✔ React then creates Virtual DOM objects Now React UI development feels more practical and clear. #ReactJS #JSX #FrontendDevelopment #LearningJourney
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