-
[react]react-router-dom의 Link를 styled-components로 꾸미기HTML·Style/Styled Components 2023. 1. 25. 16:48
일반적인 React의 컴포넌트(react-router-dom의 Link 같은)는 어떻게 styled-components로 스타일링할까?
▶ react-router-dom의 Link를 styled-components로 꾸미기
import styled from "styled-components"; import { Link } from "react-router-dom"; const StyledLink = styled(Link)` box-sizing: border-box; display: block; padding: 4px 8px; margin: 0 auto; text-align: center; `; export default function Header() { return ( <> <StyledLink to="/">Home</StyledLink> <StyledLink to="/login">LogIn</StyledLink> </> ); }참조)
'HTML·Style > Styled Components' 카테고리의 다른 글
Styled-components로 테마모드 변경하기(다크모드·라이트모드) (0) 2023.06.21 [styled-components] 다른 component에 접근해서 css를 바꿔보자! (0) 2023.02.07 [Styled Components] 전역 스타일(Global Style)과 기본 스타일(Default Theme) 관리 (0) 2022.12.21 [React] Styled Components 사용 방법 (0) 2022.12.15