JavaScript

Introduction to React: Components and Props

React logo and component structure diagram
Introduction to React: Components and Props
React changed the way we think about frontend development by introducing the component model. In React, everything is a component—a reusable piece of UI that manages its own logic. Think of it like Lego blocks. You have a Button component, a Card component, and you assemble them to build a page. Props (properties) are how you pass data from a parent component to a child component. For example, a parent component might send a 'username' prop to a Profile component. The Profile component then renders that username. The key rule of props is that they are immutable—a child component cannot change its own props; it can only read them. When I started learning React, I spent a lot of time figuring out where to keep 'state'. State is data that changes over time, and it usually lives in the parent component, which then passes it down via props.
4,162
Views
150
Words
1 min read
Read Time
May 2025
Published
← All Articles 📂 JavaScript