tough-griff / redux-react-router-todomvc Goto Github PK
View Code? Open in Web Editor NEWAn implementation of TodoMVC using React, Redux, React-Router, Immutable.js, and more!
License: MIT License
An implementation of TodoMVC using React, Redux, React-Router, Immutable.js, and more!
License: MIT License
I ran npm start
.
ERROR in ./js/components/TodoRouter.jsx
Module not found: Error: Cannot resolve module 'react-router/lib/BrowserHistory' in F:\_vms\HomesteadCode\_live\misc\redux-react-router-todomvc\js\components
@ ./js/components/TodoRouter.jsx 27:36-78
I downloaded the app, ran npm install, and then npm start and it crashed immediately.
Here's the screenshot and i'm attaching the log as well.
Hi There,
How to make this example work with pushstate. The app works only if I use http://localhost:8080/ but using any other path like http://localhost:8080/todos/all, http://localhost:8080/todos/active returns
Cannot GET /todos/active
Thanks
Zafer
handleClick(e) { ... }
// vs.
onClick(e) { ... }
See discussion here.
// ES7 function binding syntax (https://github.com/zenparsing/es-function-bind)
class MyComponent extends Component {
handleClick(e) { ... }
render() {
return (
<div onClick={::this.handleClick} />
);
}
}
// vs. ES7 class properties & arrow functions
class MyComponent extends Component {
handleClick = (e) => { ... }
return() {
return (
<div onclick={this.handleClick} />
);
}
}
// vs. explicit binding in constructor
class MyComponent extends Component {
constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this);
}
handleClick(e) { ... }
render() {
return (
<div onClick={this.handleClick} />
);
}
}
With multiple lines: use explicit return, wrap in parens, or neither?
// Explicit return
addTodo(state, payload) {
return state.update('todoList', todoList => {
return todoList.push(Immutable.fromJS(payload.todo));
});
}
const completeCount = todos.reduce((count, todo) => {
return (todo.isComplete) ? count + 1 : count;
}, 0);
// vs. wrapped in parenthesis
addTodo(state, payload) {
return state.update('todoList', todoList => (
todoList.push(Immutable.fromJS(payload.todo))
));
}
const completeCount = todos.reduce((count, todo) => (
(todo.isComplete) ? count + 1 : count
), 0);
// vs. nothing
addTodo(state, payload) {
return state.update('todoList', todoList =>
todoList.push(Immutable.fromJS(payload.todo))
);
}
const completeCount = todos.reduce((count, todo) =>
(todo.isComplete) ? count + 1 : count
, 0);
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.