buttn.css 및 button.js를 반응 앱의 동일한 폴더에 보관했지만 CSS는 렌더링되지 않습니다.
Button.css
.Button {
background-color: transparent;
border: none;
color: white;
outline: none;
cursor: pointer;
font: inherit;
padding: 10px;
margin: 10px;
font-weight: bold;
}
.Button:first-of-type {
margin-left: 0;
padding-left: 0;
}
.Success {
color: #5C9210;
}
.Danger {
color: #944317;
}
Button.js
import React from 'react';
import classes from './Button.css';
const Button = (props) => (
<button
className={[classes.Button,classes[props.btnType]].join(' ')}
onClick={props.clicked}>{props.children}</button>
);
export default Button;
모든 요소에 대해 공통 CSS 시트를 만들지 않고 진행하는 방법을 제안하십시오.
create-react-app을 사용하는 경우 css 파일의 이름은 Button.module.css 여야합니다 .
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다