Composing a Simple Profile Card
Combine View, Text, and Image to build a profile card component that shows an avatar, name, and bio, reinforcing component composition skills.
Component Composition in React Native
Composition means building big UI from small pieces. A profile card mixes a View, an Image, and Text — and once built, you can reuse it for every user.
// The goal: a reusable ProfileCard component
// that accepts props and renders a complete card UI
// Usage:
<ProfileCard
name='Alice Johnson'
role='Senior Developer'
bio='Building great mobile apps with React Native.'
avatarUri='https://i.pravatar.cc/150?img=1'
followers={1240}
/>Planning the Card Layout
Before coding, plan the card: avatar, name, role, bio, maybe a stats row. A column for the overall layout, a row for side-by-side bits. A quick sketch saves time.
// Conceptual structure (pseudo-code)
<View card>
<Image avatar />
<Text name />
<Text role />
<Text bio />
<View statsRow>
<View stat><Text number/><Text label/></View>
<View stat><Text number/><Text label/></View>
<View stat><Text number/><Text label/></View>
</View>
</View>All lessons in this course
- The View Component as a Container
- Displaying Text and Styling Fonts
- Showing Images from Local and Remote Sources
- Composing a Simple Profile Card