Git Product home page Git Product logo

redux-example-todo's People

Contributors

taggon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

redux-example-todo's Issues

server 예제 에러

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':

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.