Just built a Random User Generator using JavaScript + API integration 🚀 This project fetches real-time user data from an API and displays it dynamically on the UI. ✨ Features: • Fetch user data using API • Display profile picture, name, email & country • Loading state while data is being fetched • Error handling for failed requests • Generate new user on button click 🧠 Concepts I practiced: • Fetch API • Async data handling • DOM Manipulation • Event Handling • Error Handling • UI state management This project helped me understand how real-world applications fetch and display dynamic data. More projects coming soon 🔥 #JavaScript #FrontendDevelopment #WebDevelopment #API #LearningInPublic
More Relevant Posts
-
Raw JSON is messy. I created something to fix it. I deployed my first project: the Universal API Engine. It’s a client-side tool that takes disorganized endpoint data and quickly turns it into a clear, searchable interface. Live Demo: https://lnkd.in/gRUV8HBj Source Code : https://lnkd.in/giuVkPvs I wanted to fully understand the DOM and network requests. So, I built this with no dependencies. It’s all in pure HTML5, CSS3, and Vanilla JavaScript. What it handles right now (v1.0): - Deep-value filtering (searches every nested object, not just top-level). - Interactive nested data exploration. - Persistent session history via LocalStorage. - Fully responsive layout with a custom dark/light theme. What’s next: Currently, it only processes textual JSON. The v2.0 roadmap includes support for multiple formats to handle raw binary data, meaning it will display images, audio, and video directly from the endpoints. Since this is my first deployment, I know the code has some flaws. There are definitely UI/UX issues hiding in there. I want to stress test this tool. Try it out, throw a huge JSON endpoint at it, and let me know where it breaks. I’m looking for honest feedback, bug reports, and tips on how to improve it. #VanillaJS #WebDevelopment #Frontend #Engineering #APIs #ChaiAurCohort #ChaiAurCode #chaiaurcode #learninginpublic
To view or add a comment, sign in
-
In this post, I focused on visualizing how data moves within a React application using a Data Flow Diagram (DFD). Understanding data flow allows developers to: • Build more organized and scalable applications • Avoid unnecessary complexity and bugs • Clearly separate logic from UI • Improve maintainability and readability This approach helped me move beyond writing components to truly understanding how data drives the entire application. #React #Frontend #WebDevelopment #JavaScript #SoftwareArchitecture #CleanCode
To view or add a comment, sign in
-
-
𝐈𝐬 𝐲𝐨𝐮𝐫 `𝐮𝐬𝐞𝐄𝐟𝐟𝐞𝐜𝐭` 𝐟𝐢𝐫𝐢𝐧𝐠 𝐰𝐚𝐲 𝐭𝐨𝐨 𝐨𝐟𝐭𝐞𝐧? 𝐘𝐨𝐮 𝐦𝐢𝐠𝐡𝐭 𝐛𝐞 𝐟𝐚𝐥𝐥𝐢𝐧𝐠 𝐟𝐨𝐫 𝐚 𝐜𝐨𝐦𝐦𝐨𝐧 𝐝𝐞𝐩𝐞𝐧𝐝𝐞𝐧𝐜𝐲 𝐚𝐫𝐫𝐚𝐲 𝐭𝐫𝐚𝐩. We've all been there: you put an object or array into your `useEffect`'s dependency array, thinking it's stable. But because JavaScript compares objects and arrays by reference, even if their content is identical, `useEffect` sees a new object on every render and re-runs your effect. This can lead to performance hits, stale data, or even infinite loops. 🚫 The Problem: ```javascript function MyComponent({ data }) { const options = { id: data.id, filter: 'active' }; useEffect(() => { // This runs every render if 'options' object is new fetchData(options); }, [options]); // 'options' is a new object reference each time // ... } ``` ✅ The Fix: Stabilize with `useMemo` If your object or array doesn't logically change across renders (or only changes based on specific primitives), wrap it in `useMemo`. This memoizes the object itself, ensuring its reference remains the same unless its dependencies actually change. ```javascript function MyComponent({ data }) { const stableOptions = useMemo(() => ({ id: data.id, filter: 'active' }), [data.id]); // Only re-create if data.id changes useEffect(() => { fetchData(stableOptions); }, [stableOptions]); // Now only re-runs if stableOptions' reference changes // ... } ``` This trick is a lifesaver for optimizing `useEffect` calls, especially when dealing with complex configurations or filtering logic passed down as props. It keeps your effects clean and your app performant. What's been your biggest `useEffect` headache, and how did you solve it? #React #FrontendDevelopment #JavaScript #Performance #WebDev
To view or add a comment, sign in
-
𝐌𝐚𝐬𝐭𝐞𝐫𝐢𝐧𝐠 𝐒𝐭𝐚𝐭𝐞 𝐋𝐨𝐠𝐢𝐜 & 𝐂𝐑𝐔𝐃 𝐎𝐩𝐞𝐫𝐚𝐭𝐢𝐨𝐧𝐬 ⚛️ Yesterday was about the "comeback," but today is about the "consistency." I spent my session diving into dynamic data management—building a Name Manager that handles full CRUD (Create, Read, Update, Delete) logic. To move from static pages to interactive apps, I focused on these three technical pillars: 🔹 𝐮𝐬𝐞𝐒𝐭𝐚𝐭𝐞 (𝐓𝐡𝐞 𝐌𝐞𝐦𝐨𝐫𝐲): In React, components reset on every render. useState acts as the persistent "brain," allowing the app to remember data even when the UI updates. I practiced using setter functions to trigger re-renders safely. 🔹 .𝐦𝐚𝐩() (𝐓𝐡𝐞 𝐔𝐈 𝐅𝐚𝐜𝐭𝐨𝐫𝐲): This is how we turn raw data into an interface. It loops through an array and transforms strings into interactive components. It’s the engine behind every dynamic list you see online. 🔹 .𝐟𝐢𝐥𝐭𝐞𝐫() (𝐓𝐡𝐞 𝐈𝐦𝐦𝐮𝐭𝐚𝐛𝐥𝐞 𝐃𝐞𝐥𝐞𝐭𝐞): React rule #1: Don't mutate state. Instead of "erasing" data from the original array, I used .filter() to create a brand-new copy. This is the secret to building predictable, bug-free applications. 𝐖𝐡𝐚𝐭 𝐈 𝐢𝐦𝐩𝐥𝐞𝐦𝐞𝐧𝐭𝐞𝐝 𝐭𝐨𝐝𝐚𝐲: ✅ Create: Added new entries using the Spread Operator [...]. ✅ Read: Rendered a dynamic, real-time list with .map(). ✅ Update/Delete: Built the logic to modify and remove specific items without breaking the state. 𝐓𝐡𝐞 𝐁𝐢𝐠 𝐓𝐚𝐤𝐞𝐚𝐰𝐚𝐲: In React, we don't modify the past; we create a fresh copy of the future! 🚀 #ReactJS #WebDevelopment #JavaScript #FrontendDeveloper #LearningInPublic
To view or add a comment, sign in
-
𝗨𝗻𝗱𝗲𝗿𝗦𝘁𝗮𝗻𝗱𝗶𝗻𝗴 𝗔𝗦𝘆𝗻𝗰/𝗔𝘄𝗮𝗶𝘁 You use fetch().then().catch() and it feels confusing. JavaScript has a cleaner way to handle waiting: async/await. There are two ways to get things done: - Synchronous: You wait for your pizza at the counter. You can't do anything else until it's ready. - Asynchronous: You get a buzzer and walk away. You can do other things while you wait. Two keywords make this work: - async: This function will wait for things. - await: Pause this line until it's done, but let everything else keep running. You can write code in two ways: - Messy: fetchData().then(res => res.json()).then(data => console.log(data)); - Clean: use async and await to get data from an API. async function getData() { try { const response = await fetch('https://lnkd.in/dz48DrYF'); const data = await response.json(); console.log('Got it!', data); } catch (err) { console.error('Oops:', err); } } Remember: - await only works inside async functions. - use try/catch to handle errors. - your app stays responsive. What's your biggest problem with async? Tell us below! Source: https://lnkd.in/g2Dsjh94
To view or add a comment, sign in
-
🚀 Day 17/30 – Custom Hooks (Deep Dive) Tired of repeating the same logic in multiple components? 🤔 Today I learned how to make React code reusable & clean ⚡ 👉 Custom Hooks Today I learned: ✅ Custom Hooks are reusable functions using React Hooks ✅ They help extract and reuse logic across components ✅ Must always start with "use" (naming convention) --- 💻 Problem: Same logic repeated in multiple components ❌ (e.g. fetching data, form handling) --- 💻 Solution: Create a custom hook ✅ --- 💻 Example: function useCounter() { const [count, setCount] = useState(0); const increment = () => setCount((prev) => prev + 1); const decrement = () => setCount((prev) => prev - 1); return { count, increment, decrement }; } function App() { const { count, increment, decrement } = useCounter(); return ( <> <h2>{count}</h2> <button onClick={increment}>+</button> <button onClick={decrement}>-</button> </> ); } --- 🔥 What actually happens: 1️⃣ Logic is written once inside custom hook 2️⃣ Any component can reuse it 3️⃣ Each component gets its own state --- 💡 Real Use Cases: - API fetching (useFetch) - Form handling (useForm) - Authentication logic - Debouncing input --- ⚡ Advanced Insight: Custom Hooks don’t share state ❌ 👉 They share logic, not data --- 🔥 Key Takeaway: Write logic once → reuse everywhere. Are you still repeating logic or using custom hooks? 👇 #React #CustomHooks #FrontendDevelopment #JavaScript #CleanCode
To view or add a comment, sign in
-
-
You’re still building forms manually from JSON? --- Every time I get a JSON response, I end up doing the same thing: → read structure → map fields → wire inputs → repeat… again --- It’s boring. It’s repetitive. And it shouldn’t exist in 2026. --- So I built something for myself: 👉 Paste JSON 👉 Get a working form instantly --- No setup. No backend. No config headaches. Just: JSON → UI --- Introducing: 🔧 JSON → Form (part of useSignal) 👉 https://lnkd.in/grSx-SEi --- It’s fully browser-native. Which means: - your data never leaves your machine - everything runs instantly - no dependency on any service --- This isn’t just a generator. It’s a way to: → skip repetitive UI work → prototype faster → actually focus on logic --- Try it once. You probably won’t go back to building forms manually. --- 💬 Curious — how are you handling JSON → forms today? #frontend #webdevelopment #javascript #reactjs #devtools #buildinpublic #productivity #developers #webdev
To view or add a comment, sign in
-
-
🚀 React Series Part 10: Custom Hooks - Reuse Logic Like a Pro So far, we’ve used built-in hooks like useState, useEffect, useMemo. But what if you want to reuse logic across components? 🤔 👉 That’s where Custom Hooks come in 💡 💡 What are Custom Hooks? Custom Hooks are just JavaScript functions that use React hooks internally. 📌 Rule: 👉 Must start with use (naming convention) 🔥 Why do we need them? Imagine writing the same logic in multiple components: • API calls • Form handling • Event listeners ❌ Leads to duplication ❌ Hard to maintain ✅ Custom Hooks solve this 🔧 Example: Reusable Counter Logic function useCounter(initialValue = 0) { const [count, setCount] = useState(initialValue); const increment = () => setCount(c => c + 1); const decrement = () => setCount(c => c - 1); return { count, increment, decrement }; } 👉 Using it in a component: const { count, increment, decrement } = useCounter(); 💡 Real-world Example: API Fetching function useFetch(url) { const [data, setData] = useState(null); useEffect(() => { fetch(url) .then(res => res.json()) .then(setData); }, [url]); return data; } 👉 Now reusable across components 🚀 🔁 What’s happening internally? • Each component gets its own isolated state • Logic is shared, not the data • Cleaner and more modular code ⚠️ Best Practices ✔ Keep hooks focused (single responsibility) ✔ Avoid too much abstraction ✔ Handle loading/error states in real apps 🧠 Simple takeaway Custom Hooks = Reusable logic 🧩 Components = UI layer 🎨 Let’s keep going 🚀 #ReactJS #Learning #frontendDev
To view or add a comment, sign in
-
𝗕𝘂𝗶𝗹𝗱 𝗖𝗟𝗜 𝗧𝗼𝗼𝗹𝘀 𝗪𝗶𝘁𝗵 𝗡𝗼𝗱𝗲.𝗷𝘀 You write JavaScript daily. You build apps and APIs. Now build tools for yourself. Stop repeating tasks. Turn them into commands. Start your file with #!/usr/bin/env node. This tells the shell to use Node.js. Run chmod +x to make it executable. Use package.json. Add a bin field. Map your command name to the script. Run npm install -g . for global use. Use npm link for development. Process.argv is hard to read. Use yargs. - It handles flags. - It adds help menus. - It validates input. Keep output clean. - Add a --json flag for data. - Use console.error for errors. - Use exit code 0 for success. - Use exit code 1 for failure. Make your tool work with other tools. Use process.stdin to read input. This lets you pipe data into your tool. Avoid repetitive flags. Create a config file like .mytoolrc. Load it using fs and path. Set up autocomplete. Your tool is now a utility. Source: https://lnkd.in/gkh_6JJs
To view or add a comment, sign in
Explore related topics
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