From the course: Master React 19 and Next.js 16 with Hands-On Projects and Real-World Applications

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Build the IconWithText component

Build the IconWithText component

In this session, we're going to build a reusable IconWithText component. This component will display an icon alongside some text, making your UI cleaner and more consistent. You'll learn how to structure components, import necessary libraries, and style them effectively. There are three components, IconWithText, inside the PropertyImage component, so let's nest them inside it. Moving to property.jsx. Now I am adding the IconWithText component import to the property.jsx file. I'm now importing the necessary icons from the Lucide React library. I'm importing Bath, Bed, and Maximize, specifically for representing bathrooms, bedrooms, and surface area, respectively. Let's scroll down. Now it is time to prepare the space to insert the new components. I created a div with the class PropertyInfo to hold the icons and text. This provides a container for better styling and organization. To begin using the IconWithText component, I'm inserting the first instance in the PropertyInfo div. This…

Contents