๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
HTML5 & CSS3/Styled-Component

Scss์— ์ต์ˆ™ํ•œ ๋ถ„๋“ค์„ ์œ„ํ•œ ๊ฐ„๋‹จ styled-component ์‚ฌ์šฉ๋ฒ•

by ์ฝ”๋”ฉํ•˜๋Š” ๋ถ•์–ด 2021. 11. 14.
๋ฐ˜์‘ํ˜•

Scss, Sass๋ฅผ ์‚ฌ์šฉํ•  ๋• ์•„๋ž˜์™€ ๊ฐ™์ด ์‚ฌ์šฉํ–ˆ์„ ๊ฒƒ์ด๋‹ค!

.mainText {
  display: flex;
  margin: 0px;
  padding: 0px;
}
import React from 'react';
import './App.scss';

class App extends React.Component {
  render() {
    return (
      <div className="mainText">
      hello world
      </div>
    );
  }
}

export default App;

 

 

 

ํ•˜์ง€๋งŒ styled-component๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์‚ฌ์šฉํ•œ๋‹ค.

import React from 'react';
import styled from 'styled-components';

const MainText = styled.div`
  display: flex;
  margin: 0px;
  padding: 0px;
`;

function App() {
  return (
    <MainText>
    hello world
    </MainText>
  );
}

export default App;

์•„์ง ์ต์ˆ™ํ•˜์ง€์•Š์€ ๋ถ„๋“ค์€ ์ผ๋‹จ ์ต์ˆ™ํ•œ ๊ฑธ๋กœ ๊ตฌํ˜„ํ•œ ํ›„ ํ•˜๋‚˜์”ฉ styled-component๋กœ ๋ฐ”๊ฟ”๋ด๋„ ๊ดœ์ฐฎ๋‹ค. (๋ณธ์ธ์ด ๊ทธ๋žฌ์Œ)
๊ฒ๋จน์ง€ ๋ง๊ณ  ์ฒœ์ฒœํžˆ ํ•˜๋‚˜์”ฉ ๋ฐ”๊ฟ”๋ณด๋ฉด ๊ธˆ๋ฐฉ ํ•  ์ˆ˜ ์žˆ์–ด์š”!!

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€