This video is available to students only

How to Create a Card in React With Styled Components

Project Source Code

Get the project source code below, and follow along with the lesson material.

Download Project Source Code

To set up the project on your local machine, please follow the directions provided in the README.md file. If you run into any issues with running the project source code, then feel free to reach out to the author in the course's Discord channel.

Previous LessonHow to Create a React Column Component LayoutNext LessonBuild a Button That Turns Into a Text Field to Add New Items

Lesson Transcript

  • [00:00 - 00:17] Create the card components. Create a new file, SRC, Card, TSX. Here we define the props for this component. Type Card Props. It will have text of type string. And then we define and export the card component itself. Expert const, card.

  • [00:18 - 00:38] Here we get the text from the props. Set the prop types, card props, and return card container that we import from the styles that renders the text. Now let's render the card inside of the column component. Instead of the card container, we can now render card and set the text prop.

  • [00:39 - 00:51] Text equals generate app scaffold, repeat it for other cards. Card learn Type Script and the last one begin to use static typing. We can remove the card container import and now we have the card component.

This lesson preview is part of the Fullstack React with TypeScript Masterclass course and can be unlocked immediately with a \newline Pro subscription or a single-time purchase. Already have access to this course? Log in here.

Unlock This Course

Get unlimited access to Fullstack React with TypeScript Masterclass, plus 70+ \newline books, guides and courses with the \newline Pro subscription.

Thumbnail for the \newline course Fullstack React with TypeScript Masterclass