5.3.2.1 컴포넌트 파일 생성

    ScrollBox.js

    import React, { Component } from 'react';
     
    class ScrollBox extends Component {
      render() {
        const style = {
          border: '1px solid black',
          height: '300px',
          width: '300px',
          overflow: 'auto',
          position: 'relative'
        };
     
        const innerStyle = {
          width: '100%',
          height: '650px',
          background: 'linear-gradient(white, black)'
        }
     
        return (
          <div 
            style={style}
            ref={(ref) => {this.box=ref}}>
            <div style={innerStyle}/>
          </div>
        );
      }
    }
     
    export default ScrollBox;

    신간 소식 구독하기
    뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.