프로그래밍(Programming)/리액트(React)
[리액트(React) Study Log] [Person App-015] Working with inline Styles
SuperKid
2019. 1. 11. 14:40
[리액트(React) Study Log] [Person App-015] Working with inline Styles
1. react 에서의 inline styling
- App.js 파일내에서 style constant 를 정의하고, style 속성에 정의했던 {style} 객체를 지정.
// src-App.js
...
render() {
const style = {
backgroundColor: 'white',
font: 'inherit',
border: '1px solid blue',
padding: '8px',
cursor: 'pointer'
}
...
<button
style={style}
onClick={() => this.switchNameHandler('AAA!')}>Switch Name</button>
...
2. 브라우져 확인