On Github FBDG / ironhee-2015-presentation
Created by Ironhee
안녕하세요 발표자 Ironhee(이철희) 라고 합니다. 이번 시간에는 React 사용 사례에 대해서 이야기 해보려 합니다.Backend < Frontend
잦은 기획의 변경
3명
글로벌 플랫폼
DOM 직접 제어
View 복잡함
가독성 낮음
재사용성 낮음
협업 어려움
AMD 전용 코드
Dependencies Hell
복잡함
프론트 개발자: 백엔드 코드를 작성
백엔드 개발자: 프론트 코드를 작성
Context Switching Cost
프론트와 백엔드의 역할 분리 X
프론트 개발자: 백엔드의 구현에 의존
팀의 핵심역량 = 프론트
Client-Side Routing 필요
더 좋은 대안
Gulp
NPM scripts
ES7 Generator
View 단순함
가독성 높음
재사용성 높음
협업 쉬움
NPM 생태계
Chunk + Lazy Loading
Plugin + Loader (Babel, Sass, postCSS)
var _ = require('lodash');  // load node module
var path = require('path');  // load built-in module
function helloWorld() {
  console.log('hello world!');
}
module.exports = helloWorld;  // export like node module
							
						
					
/* webpack.config.js */
export default {
  // configs...
  plugins: [
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: VERBOSE,
      },
    }),
  ],
  module: {
    loaders: [
      {
        test: /\.(js|es6)$/,
        include: path.join(__dirname, '../src'),
        loaders: [...DEBUG ? ['react-hot'] : [], 'babel'],
      },
      {
        test: /\.scss$/,
        include: path.join(__dirname, '../src'),
        loaders: ['style/useable', 'css', 'postcss', 'sass?sourceMap'],
      },
      {
        test: /\.css$/,
        loaders: ['style/useable', 'css', 'postcss'],
      },
    ],
  },
};
							
						
					ES6 / ES7
JSX
import _ from 'lodash';
const helloWorld = () => {
  console.log('hello world!');
}
const jsx = (
  
'use strict';
Object.defineProperty(exports, '__esModule', {
  value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
var helloWorld = function helloWorld() {
  console.log('hello world!');
};
var jsx = React.createElement(
  'div',
  null,
  React.createElement(
    'h1',
    null,
    'Hello world'
  )
);
exports['default'] = helloWorld;
module.exports = exports['default'];
							
						
					프론트 개발자: 프론트 코드를 작성
백엔드 개발자: 백엔드 코드를 작성
단일 책임 원칙
백엔드라우팅 의존성 제거
추가적 Refresh X
Chunk + Lazy Loading
Just Javascript
유연함
단순함
'쿠폰 생성 페이지가 필요해요!'
Run Webpack Devserver
Dummy Component 작성
Router 에 Component 추가
Header 에 CouponPage Link 추가
Browser 에서 구현 확인
Component UI 구현
Style 적용
Store 및 Action 구현
Component 에서 Store & Action 이용하도록 변경
=>Browser 에서 구현 확인
=>다국어 (Intl) 적용
서버와 연동 (REST API)
http://ironhee.github.io/ironhee-frontend-boilerplate