🚀 Built a Search Feature in React! Today I worked on implementing a simple yet powerful search functionality using React and React Router. 🔍 What I learned: * Managing input state using `useState` * Handling form submission properly with `preventDefault()` * Using `useNavigate` for dynamic routing * Passing search queries via URL parameters 💡 Key idea: Instead of storing search globally, we can pass it through the URL like: `/search?query=yourText` This makes the feature scalable and shareable. 🧠 Here’s a simplified version of the logic: ```jsx const handleSearch = (e) => { e.preventDefault(); if (!search.trim()) return; navigate(`/search?query=${search}`); setSearch(""); }; ``` ✨ Small steps like this build the foundation for larger applications. Next, I’m planning to: * Read query params on the results page * Implement live search (without submit) * Add debouncing for performance #React #JavaScript #WebDevelopment #Frontend #LearningInPublic
Implementing Search in React with React Router
More Relevant Posts
-
Stop spamming "use client" everywhere in Next.js — it's silently killing your React Server Components. 👇 Most Next.js devs are accidentally turning off React Server Components — and don't even know it. The moment you add "use client" to a parent component, every child inside it becomes a client component too. No async data fetching. No streaming. No zero-JS HTML. Just a bigger JS bundle landing in your user's browser. ❌ Why it hurts Adding "use client" to a parent component converts the entire subtree into a client bundle. Every child component, every import — all sent to the browser. You lose async data fetching, streaming, and zero-JS rendering on the server. Most devs add it to silence hydration errors without understanding the blast radius. ✅ The right mental model Push "use client" as deep as possible — to the leaf component that actually needs state or browser APIs (onClick, useState, useEffect). Keep pages and layouts as Server Components. This way Next.js can stream HTML fast, skip JS for static parts, and still hydrate only the interactive pieces. I've seen this on almost every App Router codebase — "use client" at the top of the page, layout, or a shared wrapper. One line, silently destroying the entire RSC architecture. The fix? Push "use client" to the leaf — the single component that actually uses useState, onClick, or a browser API. Keep everything above it on the server. Golden rule: "use client" is a boundary, not a decorator. Place it at the edge, not the root. #NextJS #ReactJS #WebDevelopment #JavaScript #TypeScript #ReactServerComponents #AppRouter #FrontendDeveloper #SoftwareEngineer #Programming #CleanCode #100DaysOfCode #WebDev #NextJS14 #React19 #ServerComponents #JSPerformance #FrontendArchitecture #CodeQuality #TechTips
To view or add a comment, sign in
-
-
🚀 React Quick Revision Here are some important React concepts explained in short 🔹 1) Which is the entry file in React? 👉 In most React apps, the entry file is index.js / main.jsx 👉 It is responsible for rendering the root component: ReactDOM.createRoot(document.getElementById("root")).render(<App />); 🔹 2) What is the datatype of useEffect second argument? 👉 It is an Array useEffect(() => {}, [dependency]); 👉 This array is called the dependency array and controls when the effect runs. 🔹 3) useState syntax explanation (arrow understanding) const [state, setState] = useState(initialValue); 👉 Breakdown: const → variable declaration [state, setState] → array destructuring useState() → hook function setState → function to update state 👉 Arrow meaning: setState is a function → used to update value 🔹 4) Difference between Tag and Component 👉 Tag (HTML Element): <div>Hello</div> Built-in HTML element Lowercase naming 👉 Component (React): <MyComponent /> Custom reusable function Always starts with uppercase Returns JSX #ReactJS #FrontendDeveloper #JavaScript #WebDevelopment #Learning
To view or add a comment, sign in
-
🚀 Why React Server Components Are Changing Modern Web Development If you're building React apps in 2026, one concept you should definitely know is React Server Components (RSC). 💡 What are Server Components? React Server Components allow certain components to render directly on the server instead of the browser. This means users receive ready-to-use HTML faster, reducing the amount of JavaScript sent to the client. 💬 Have you tried React Server Components yet? What do you think about them? #React #WebDevelopment #Frontend #NextJS #JavaScript #Programming #SoftwareDevelopment #ReactJS #TechTrends
To view or add a comment, sign in
-
-
I ignored React keys for a long time… because I thought they were just warnings 😅 Then I learned why they actually matter 👇 Imagine you have a list of users: {users.map((user) => ( <UserCard key={user.id} user={user} /> ))} React uses the key to know: ➡️ which item stayed the same ➡️ which item was removed ➡️ which item was added Without keys: React gets confused 😵 This can cause: ❌ Wrong data showing ❌ Unnecessary re-renders ❌ Weird bugs Common beginner mistake: key={index} This works sometimes… but can break when list order changes. ✅ Better: use a unique id key={user.id} Simple rule: Keys help React track items correctly. Not just remove warnings 👀 #reactjs #frontend #webdevelopment #javascript
To view or add a comment, sign in
-
-
🚀 React is changing again… and most developers are behind. Have you heard about **React Server Components?** 🤔 They’re not just a new feature — they change how we think about frontend. 💡 What are Server Components? 👉 Components that run on the **server**, not in the browser ⚡ Why this matters: • Less JavaScript sent to the client • Faster page load 🚀 • Better performance by default • Direct access to backend (no extra API calls) 🧠 Client vs Server: 🔹 Client Components → Run in browser → Use state, effects, event handlers 🔹 Server Components → Run on server → No state, no useEffect → Fetch data directly 🔥 Real benefit: You can fetch data like this (on server): → No loading states → No extra API layer → Cleaner code ⚠️ But remember: Not everything should be a Server Component Use Client Components when you need: • Interactivity • State • User events This is a big shift in React thinking ⚡ Are you using Server Components yet? Or still on traditional React? 🤝 #ReactJS #NextJS #WebDevelopment #Frontend #JavaScript
To view or add a comment, sign in
-
-
What if your frontend became lighter and your backend more secure — without adding complexity? That shift is already happening in the JavaScript ecosystem. 🔵 React Server Components are approaching a stable release. By rendering on the server, they reduce the amount of JavaScript sent to the browser and minimize hydration overhead. The result? Faster, more scalable applications with improved performance out of the box. 🟢 Node.js is introducing a Permission Model with fine-grained runtime flags like --allow-fs-read and --allow-net. This brings a true least-privilege approach to backend security — without requiring heavy configuration or additional tooling. Together, these advancements are shaping a future where performance and security are built-in defaults, not afterthoughts. This is a quiet but significant evolution — a “silent upgrade” that could define the next generation of web applications. Are you already experimenting with React Server Components or Node.js permission flags? I’d love to hear your experience 👇 #ReactJS #NodeJS #WebPerformance #AppSecurity #JavaScript #WebDevelopment #SoftwareEngineering
To view or add a comment, sign in
-
-
One of the most powerful combinations in modern web development: Laravel + Vue.js + Inertia.js. Inertia.js eliminates the need for a separate API layer by connecting your Laravel backend directly to your Vue frontend — giving you the feel of a single-page application without the complexity of building two separate projects. The result? Faster development, simpler authentication, and a cleaner codebase. This is the stack I use to deliver full-stack web applications that are both performant and easy to maintain. #InertiaJS #VueJS #Laravel #FullStack #WebDevelopment #JavaScript
To view or add a comment, sign in
-
-
🚀 Proxies (JavaScript) Proxies provide a way to intercept and customize fundamental operations on objects, such as property access, assignment, and function calls. They allow you to create wrappers around objects that can control and modify their behavior. Proxies are useful for implementing features like validation, logging, performance monitoring, and data binding. They provide a powerful mechanism for metaprogramming in JavaScript. Learn more on our app: https://lnkd.in/gefySfsc #JavaScript #WebDev #Frontend #JS #professional #career #development
To view or add a comment, sign in
-
-
I recently worked on a project where I had to optimize the performance of a Next.js application It was a real challenge, and I made a mistake that cost me hours of debugging I was trying to implement a complex UI pattern using React But I forgot to memoize a component, causing it to re-render unnecessarily As I was debugging, I had a realization that I should have used the React DevTools to identify the issue earlier This would have saved me a lot of time and frustration A practical takeaway from this experience is to always use the React DevTools to identify performance bottlenecks It's a simple yet effective way to optimize the performance of your React applications What's the most common mistake you've made when optimizing the performance of a React application #NextJs #React #PerformanceOptimization #FrontendEngineering #UIPatterns #ReactDevTools #JavaScript #WebDevelopment #OptimizationTechniques
To view or add a comment, sign in
-
CORS becomes very easy to understand with one real example. Imagine this: You’re building a React app on http://localhost:3000 Your backend API is running on http://localhost:8000 From your frontend, you make a request: fetch("http://localhost:8000/api/profile") Looks normal, right? But the browser sees this as: Frontend → localhost:3000 Backend → localhost:8000 Same machine. Same localhost. Different port. And that different port is enough for the browser to say: “Hold on — this is a different origin. I need permission first.” So before sending the real request, the browser asks your backend: “Is localhost:3000 allowed to access you?” That’s the CORS check. If your backend responds with: Access-Control-Allow-Origin: http://localhost:3000 The browser allows the request. If not, it blocks it and throws the CORS error. That’s why this fails: fetch("http://localhost:8000/api/profile") Not because your API is broken. Not because React failed. But because the browser is protecting the user. And that’s the key thing most beginners miss: CORS is not a server error. It’s the browser asking the server for permission. Once you understand that, CORS stops feeling random. #Frontend #WebDevelopment #JavaScript #ReactJS #NodeJS #FullStack #SoftwareEngineering #Developers #TechConcepts
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