Skip to main content

Featured

🎉 Day 46 — React Mastery Completed (Final Summary & Congratulations!)

🎉 Day 46 — React Mastery Completed (Final Summary & Congratulations!) Congratulations, developer! 👏 You’ve successfully completed the 45-Day React.js Roadmap — from understanding the fundamentals to mastering advanced concepts like Redux, Routing, Testing, and Deployment. 📘 What You’ve Learned ✅ React basics — Components, JSX, Props, and State ✅ Hooks — useState, useEffect, useRef, useMemo, and Custom Hooks ✅ Context API and Redux Toolkit for global state management ✅ Routing with React Router & Protected Routes ✅ Data fetching using Fetch API, Axios, React Query ✅ Advanced Patterns — Compound Components, Render Props, HOCs ✅ Styling — CSS Modules, Styled Components, Theming ✅ Animations, Accessibility, Testing, and Performance Optimization ✅ Deployment on Vercel, Netlify, or GitHub Pages 🧩 Final Project Ideas Now that you’re done, build real-world apps to polish your skills: 📝 Task ...

📘 Day 4 — Components & Props

📘 Day 4 — Components & Props

React applications are built using components — small, reusable pieces of UI that represent parts of your app. Components can be **functional** or **class-based**, though functional components are more common in modern React (with hooks).

🔹 Functional Components

function Welcome(props) {
  return <h1>Hello, {props.name}!</h1>;
}

export default Welcome;
  

🔸 Using Props (Properties)

Props are used to pass data from a parent component to a child component. They make your components **dynamic and reusable**.

function App() {
  return (
    <div>
      <Welcome name="Rahul" />
      <Welcome name="Sara" />
    </div>
  );
}
  

💡 Best Practices

  • Keep components small and focused.
  • Use PascalCase for component names.
  • Use props destructuring for cleaner code.

Comments