taggon / redux-example-todo Goto Github PK
View Code? Open in Web Editor NEWRedux 예제용 Todo 프로젝트
License: MIT License
Redux 예제용 Todo 프로젝트
License: MIT License
server branch 를 실행하고 localhost:3000/ 에 엑세스하면
/Users/hyun/dev/study/react/redux-example-todo/dist/page.js:21129
return action.todos.map(function (text, idx) {
^
TypeError: Cannot read property 'map' of undefined
at todos (/Users/hyun/dev/study/react/redux-example-todo/dist/page.js:21129:27)
at dispatch (/Users/hyun/dev/study/react/redux-example-todo/dist/page.js:19835:23)
at Object.initTodo (/Users/hyun/dev/study/react/redux-example-todo/dist/page.js:20480:13)
at new TodoApp (/Users/hyun/dev/study/react/redux-example-todo/dist/page.js:19574:14)
at ReactCompositeComponentWrapper.mountComponent (/Users/hyun/dev/study/react/redux-example-todo/dist/page.js:7103:19)
at ReactCompositeComponentWrapper.wrapper [as mountComponent] (/Users/hyun/dev/study/react/redux-example-todo/dist/page.js:1315:22)
at /Users/hyun/dev/study/react/redux-example-todo/dist/page.js:18653:39
at ReactServerRenderingTransaction.perform (/Users/hyun/dev/study/react/redux-example-todo/dist/page.js:6595:21)
at Object.renderToString (/Users/hyun/dev/study/react/redux-example-todo/dist/page.js:18651:25)
at exports.default (/Users/hyun/dev/study/react/redux-example-todo/dist/page.js:69:39)
이런 에러가 나오는데, 초기에 todo가 initialize 되어있지 않아서 문제가 생기는것 같습니다. 아래와 같이 수정이 필요해보입니다.
diff --git a/server.js b/server.js
index e0658de..5dd3f29 100644
--- a/server.js
+++ b/server.js
@@ -11,7 +11,7 @@ server.on('request', function(req, res){
case '/':
status = 200;
content = fs.readFileSync('./index.html');
- content = content.toString().replace('<% page %>', page());
+ content = content.toString().replace('<% page %>', page(todos));
content = content.replace('<% state %>', JSON.stringify(todos));
break;
case '/added':
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.