This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "todo", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], | |
"author": "hckrmoon <[email protected]> (http://blog.hckrmn.net/)", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
entry: './index.js', | |
output: { | |
filename: 'bundle.js' | |
}, | |
module: { | |
loaders: [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<div id="root"></div> | |
<script src="./bundle.js"></script> | |
</body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import {render} from 'react-dom'; | |
const App = () => ( | |
<div>Hello?</div> | |
); | |
render(<App />, document.getElementById('root')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"visible": "SHOW_ALL", | |
"todos": [ | |
{ | |
"id": 1, | |
"text": "", | |
"completed": false | |
}, | |
{ | |
"id": 2, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { render } from 'react-dom'; | |
import { createStore } from 'redux'; | |
import { Provider } from 'react-redux'; | |
import reducer from './reducers'; | |
import App from './containers/app'; | |
let store = createStore(reducer); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Todo 의 아이디 todo 의 갯수가 늘때마다 +1 해준다. | |
let nextTodoId = 0; | |
// Todo 의 상태(completed/uncompleted) 를 변경한다. | |
export const toggleTodo = (id) => { | |
return { | |
type: 'TOGGLE_TODO', | |
id | |
}; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const visible = (state = 'SHOW_ALL', action) => { | |
switch (action.type) { | |
case 'SET_VISIBLE': | |
return action.filter; | |
default: | |
return state; | |
} | |
}; | |
const toggleTodo = (todo, id) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by youngmoon on 2/12/16. | |
*/ | |
import React from 'react'; | |
import { bindActionCreators } from 'redux'; | |
import { connect } from 'react-redux'; | |
import * as ActionCreators from '../actions'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { PropTypes } from 'react'; | |
/** | |
* Define React Presentational Component Add | |
*/ | |
const Add = ({ onSubmit }) => { | |
let input; | |
const submit = (e) => { | |
e.preventDefault(); | |
if (!input.value) return; |