#React로 간단한 유니버설 모듈성을 정의하고 CSS 색상 바꾸기(#Codepen)
8153 단어 React
요컨대
문턱을 최소화하는 전략을 취해라.
React on CodePen - React Patterns & Templates
보기 좋은 교재를 고르다.
Codepen
자신에게 적합한 물건.
A Pen by yumainaura
주안점
박스라는 유니버설 모듈을 만들었어요.
App Component에서 3개의 Box Component 호출
colorMode 변경
CSS에서 colorMode 정의
colorMode는'가짜일 때 아무것도 쓰지 않는다'는 동작을 할 수 있을 것 같다.
(#루비의 외로운 계산과도 닮은 듯)
js // This is how a function component takes props.
const Box = props => (
<div className={`box ${props.colorMode}`}>
<h1 className="title">{props.title}</h1>
</div>
);
// This Class component also can have props
class App extends React.Component {
render() {
return <div>
<h1 class="subtitle">
{this.props.header}
</h1>
<Box
colorMode="false"
title="Light"
/>
<Box
colorMode="dark-mode"
title="Dark"
/>
<Box
colorMode="orange-mode"
title="Orange"
/>
</div>;
}
}
ReactDOM.render(<App header="Hello, Colors!"/>, document.getElementById("root"));
css body {
height: 100vh;
margin: 0;
display: grid;
place-items: center;
max-width: 250px;
margin: 0 auto;
}
.box {
width: 300px;
&.dark-mode {
background: black;
color: #bbb;
h1 {
color: white;
}
.checkbox:hover {
color: white;
}
}
&.orange-mode {
background: orange;
color: red;
h1 {
color: red;
}
.checkbox:hover {
color: red;
}
}
}
HTML <div id="root"></div>
Reference
이 문제에 관하여(#React로 간단한 유니버설 모듈성을 정의하고 CSS 색상 바꾸기(#Codepen)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/YumaInaura/items/68f7f9576ca0febfecfd
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
보기 좋은 교재를 고르다.
Codepen
자신에게 적합한 물건.
A Pen by yumainaura
주안점
박스라는 유니버설 모듈을 만들었어요.
App Component에서 3개의 Box Component 호출
colorMode 변경
CSS에서 colorMode 정의
colorMode는'가짜일 때 아무것도 쓰지 않는다'는 동작을 할 수 있을 것 같다.
(#루비의 외로운 계산과도 닮은 듯)
js // This is how a function component takes props.
const Box = props => (
<div className={`box ${props.colorMode}`}>
<h1 className="title">{props.title}</h1>
</div>
);
// This Class component also can have props
class App extends React.Component {
render() {
return <div>
<h1 class="subtitle">
{this.props.header}
</h1>
<Box
colorMode="false"
title="Light"
/>
<Box
colorMode="dark-mode"
title="Dark"
/>
<Box
colorMode="orange-mode"
title="Orange"
/>
</div>;
}
}
ReactDOM.render(<App header="Hello, Colors!"/>, document.getElementById("root"));
css body {
height: 100vh;
margin: 0;
display: grid;
place-items: center;
max-width: 250px;
margin: 0 auto;
}
.box {
width: 300px;
&.dark-mode {
background: black;
color: #bbb;
h1 {
color: white;
}
.checkbox:hover {
color: white;
}
}
&.orange-mode {
background: orange;
color: red;
h1 {
color: red;
}
.checkbox:hover {
color: red;
}
}
}
HTML <div id="root"></div>
Reference
이 문제에 관하여(#React로 간단한 유니버설 모듈성을 정의하고 CSS 색상 바꾸기(#Codepen)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/YumaInaura/items/68f7f9576ca0febfecfd
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
박스라는 유니버설 모듈을 만들었어요.
App Component에서 3개의 Box Component 호출
colorMode 변경
CSS에서 colorMode 정의
colorMode는'가짜일 때 아무것도 쓰지 않는다'는 동작을 할 수 있을 것 같다.
(#루비의 외로운 계산과도 닮은 듯)
js // This is how a function component takes props.
const Box = props => (
<div className={`box ${props.colorMode}`}>
<h1 className="title">{props.title}</h1>
</div>
);
// This Class component also can have props
class App extends React.Component {
render() {
return <div>
<h1 class="subtitle">
{this.props.header}
</h1>
<Box
colorMode="false"
title="Light"
/>
<Box
colorMode="dark-mode"
title="Dark"
/>
<Box
colorMode="orange-mode"
title="Orange"
/>
</div>;
}
}
ReactDOM.render(<App header="Hello, Colors!"/>, document.getElementById("root"));
css body {
height: 100vh;
margin: 0;
display: grid;
place-items: center;
max-width: 250px;
margin: 0 auto;
}
.box {
width: 300px;
&.dark-mode {
background: black;
color: #bbb;
h1 {
color: white;
}
.checkbox:hover {
color: white;
}
}
&.orange-mode {
background: orange;
color: red;
h1 {
color: red;
}
.checkbox:hover {
color: red;
}
}
}
HTML <div id="root"></div>
Reference
이 문제에 관하여(#React로 간단한 유니버설 모듈성을 정의하고 CSS 색상 바꾸기(#Codepen)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/YumaInaura/items/68f7f9576ca0febfecfd
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
colorMode는'가짜일 때 아무것도 쓰지 않는다'는 동작을 할 수 있을 것 같다.
(#루비의 외로운 계산과도 닮은 듯)
js // This is how a function component takes props.
const Box = props => (
<div className={`box ${props.colorMode}`}>
<h1 className="title">{props.title}</h1>
</div>
);
// This Class component also can have props
class App extends React.Component {
render() {
return <div>
<h1 class="subtitle">
{this.props.header}
</h1>
<Box
colorMode="false"
title="Light"
/>
<Box
colorMode="dark-mode"
title="Dark"
/>
<Box
colorMode="orange-mode"
title="Orange"
/>
</div>;
}
}
ReactDOM.render(<App header="Hello, Colors!"/>, document.getElementById("root"));
css body {
height: 100vh;
margin: 0;
display: grid;
place-items: center;
max-width: 250px;
margin: 0 auto;
}
.box {
width: 300px;
&.dark-mode {
background: black;
color: #bbb;
h1 {
color: white;
}
.checkbox:hover {
color: white;
}
}
&.orange-mode {
background: orange;
color: red;
h1 {
color: red;
}
.checkbox:hover {
color: red;
}
}
}
HTML <div id="root"></div>
Reference
이 문제에 관하여(#React로 간단한 유니버설 모듈성을 정의하고 CSS 색상 바꾸기(#Codepen)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/YumaInaura/items/68f7f9576ca0febfecfd
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
// This is how a function component takes props.
const Box = props => (
<div className={`box ${props.colorMode}`}>
<h1 className="title">{props.title}</h1>
</div>
);
// This Class component also can have props
class App extends React.Component {
render() {
return <div>
<h1 class="subtitle">
{this.props.header}
</h1>
<Box
colorMode="false"
title="Light"
/>
<Box
colorMode="dark-mode"
title="Dark"
/>
<Box
colorMode="orange-mode"
title="Orange"
/>
</div>;
}
}
ReactDOM.render(<App header="Hello, Colors!"/>, document.getElementById("root"));
body {
height: 100vh;
margin: 0;
display: grid;
place-items: center;
max-width: 250px;
margin: 0 auto;
}
.box {
width: 300px;
&.dark-mode {
background: black;
color: #bbb;
h1 {
color: white;
}
.checkbox:hover {
color: white;
}
}
&.orange-mode {
background: orange;
color: red;
h1 {
color: red;
}
.checkbox:hover {
color: red;
}
}
}
HTML <div id="root"></div>
Reference
이 문제에 관하여(#React로 간단한 유니버설 모듈성을 정의하고 CSS 색상 바꾸기(#Codepen)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/YumaInaura/items/68f7f9576ca0febfecfd
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
<div id="root"></div>
Reference
이 문제에 관하여(#React로 간단한 유니버설 모듈성을 정의하고 CSS 색상 바꾸기(#Codepen)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/YumaInaura/items/68f7f9576ca0febfecfd텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)