npm i styled-components
import styled from "styled-components";
vscode-styled-components 익스텐션 설치하기!
const 작명(첫글자는 대문자) = styled.원하는태그`CSS코드`
//App.js
import styled from "styled-components";
const Father = styled.div`
display: flex;
`
const BoxOne = styled.div`
background-color: teal;
width: 100px;
height: 100px;
`
const BoxTwo = styled.div`
background-color: tomato;
width: 100px;
height: 100px;
`
const Text = styled.span`
color: white;
font-size: 30px;
`
function App() {
return (
<Father>
<BoxOne>
<Text>Hello World!</Text>
</BoxOne>
<BoxTwo />
</Father>
);
}
export default App;