Code To Learn logo

Code To Learn

M1: React Fundamentals

L7: Module 1 Review

Consolidate your React fundamentals knowledge and celebrate your progress.

Congratulations! You've completed Module 1. Let's review everything you've learned and see how far you've come.


What You Built

You created a property listing homepage with:

  • Reusable React components
  • Dynamic data rendering
  • Props for component communication
  • Professional styling with Tailwind CSS
  • Responsive grid layout

Key Concepts Mastered

1. JSX (JavaScript + XML)

Core Concept

JSX lets you write HTML-like code in JavaScript:

JSX Example
const element = <h1>Hello, React!</h1>;

Key points:

  • Use className instead of class
  • Use {} for JavaScript expressions
  • Close all tags (even <img />)
  • camelCase for attributes (onClick, not onclick)

2. Components

Core Concept

Components are reusable pieces of UI:

Component Example
function PropertyCard({ title, price }) {
   return (
      <div>
         <h3>{title}</h3>
         <p>${price}/night</p>
      </div>
   );
}

Component rules:

  • Start with capital letter
  • Can be functions or classes (we use functions)
  • Return JSX
  • Should be focused and reusable

3. Props

Core Concept

Props pass data from parent to child:

Props Example
// Parent passes props
<PropertyCard title='Beach House' price={200} />;

// Child receives props
function PropertyCard({ title, price }) {
   return (
      <div>
         {title}: ${price}
      </div>
   );
}

Props characteristics:

  • Read-only (immutable)
  • Passed from parent to child
  • Can be any JavaScript value
  • Use destructuring for cleaner code

4. Array.map() for Lists

Core Concept

Render dynamic lists with .map():

Array.map() for Lists
function PropertyList({ properties }) {
   return (
      <div>
         {properties.map((property) => (
            <PropertyCard
               key={property.id}
               title={property.title}
               price={property.price}
            />
         ))}
      </div>
   );
}

Map rules:

  • Always provide unique key prop
  • Use id or unique identifier
  • Keys help React track changes
  • Don't use array index as key

5. Component Composition

Core Concept

Build complex UIs by combining small components:

Header.jsx
PropertyCard.jsx (x4)

Benefits:

  • Code reuse
  • Easier testing
  • Better organization
  • Simpler maintenance

Your Component Architecture

Let's visualize what you built:

HomePage.jsx
PropertyList.jsx
PropertyCard.jsx
App.jsx
main.jsx

Data flow:

Data Creation Properties array defined in HomePage.jsx

Data Passing HomePage passes array to PropertyList via props

Data Transformation PropertyList maps array to PropertyCard components

Data Display PropertyCard displays individual property data


Before and After

Before Module 1:

  • Empty React project
  • Default boilerplate code
  • No understanding of components

After Module 1:

  • Working property listing page
  • Three custom components
  • Understanding of JSX, props, and composition
  • Professional styling with Tailwind CSS
  • Responsive layout

Common Patterns You Learned


Skills Progression

You can now:

  • āœ… Create functional components with proper syntax
  • āœ… Write JSX with JavaScript expressions
  • āœ… Pass and receive props between components
  • āœ… Destructure props for cleaner code
  • āœ… Render lists dynamically with .map()
  • āœ… Use keys correctly for list items
  • āœ… Style components with Tailwind CSS
  • āœ… Build responsive layouts with CSS Grid
  • āœ… Compose components into larger UIs
  • āœ… Organize project with proper file structure

Module 1 Milestones


Debugging Tips You've Learned

Common Issues & Solutions

"Cannot read property of undefined"

  • Check that props are being passed correctly
  • Verify data structure matches component expectations

"Each child in a list should have a unique key prop"

  • Add key={property.id} to mapped components
  • Use unique identifiers, not array indexes

"className is not defined"

  • Import Tailwind directives in index.css
  • Restart dev server after Tailwind installation

Component not displaying

  • Check that component is imported
  • Verify component is exported with export default
  • Ensure JSX is returned from component

React Developer Tools


What's Next?

In Module 2, you'll learn:

Coming Up
  • State management with useState
  • Event handling (clicks, inputs, forms)
  • Conditional rendering (show/hide elements)
  • Lifting state up (sharing state between components)
  • Building search filters for your properties

You'll add interactivity to your static homepage!


Practice Before Moving On


Celebrate Your Progress! šŸŽ‰

You've learned the fundamental building blocks of React:

  • Components
  • JSX
  • Props
  • Composition
  • Dynamic rendering

These concepts form the foundation for everything else in React. You're now ready to add interactivity with state and events!


Self-Assessment

Rate your understanding:


Resources for Further Learning


Final Checkpoint āœ…

Before moving to Module 2, ensure:

  • āœ… Your homepage displays multiple property cards
  • āœ… Data flows from HomePage → PropertyList → PropertyCard
  • āœ… Styling looks professional with Tailwind CSS
  • āœ… Layout is responsive on different screen sizes
  • āœ… You understand components, props, and composition
  • āœ… No console errors in browser DevTools

Ready for Module 2?

Great work completing Module 1! You've built a solid foundation. In Module 2, you'll make your application interactive with state and events.


Module 1 Complete! You're officially a React developer. Keep building! šŸš€