...
/Creating a Reusable Styled Component with Emotion
Creating a Reusable Styled Component with Emotion
Learn how to create a reusable styling component with Emotion.
We'll cover the following...
We'll cover the following...
In this section, we are going to learn how to create reusable styled components while styling the HomePage component. Let’s carry out the following steps:
We will start with the Page component in
Page.tsxand add the following lines to the top of the file:
/** @jsxImportSource @emotion/react */import { css } from '@emotion/react';
Let’s style the
divelement and place the page content in the center of the screen:
export const Page = ({ title, children }: Props) => (<divcss={css`margin: 50px auto 20px auto;padding: 30px 20px;max-width: 600px;`}>...</div> );
Let’s move to
HomePage.tsxand add the following lines to the top of the ...