Closed jasonswearingen closed 8 years ago
The problem is that you're following the example for master
, which has changed considerably. Here's an example for 1.0.2: https://github.com/rackt/redux-simple-router/blob/1.0.2/examples/basic/app.js, which hopefully should work as expected for you :)
ok, thanks very much for the help!!!
fyi, besides looking at the wrong version of the example, my problem was
module reducers {
/**
* ./reducers/count.js
*/
export module count {
export const initialState = { number: 1 };
export function update(state = initialState, action: IAction) {
if (action.type === constants.INCREASE) {
return { number: state.number + action.amount };
} else if (action.type === constants.DECREASE) {
return { number: state.number - action.amount };
}
return state;
}
}
}
Since I'm putting all the code in one file, i should have exported the update() as count() instead:
module reducers {
/**
* ./reducers/count.js
*/
//export module count {
const initialState = { number: 1 };
export function count(state = initialState, action: IAction) {
if (action.type === constants.INCREASE) {
return { number: state.number + action.amount };
} else if (action.type === constants.DECREASE) {
return { number: state.number - action.amount };
}
return state;
}
//}
}
now all's working!
I'm trying to follow along the basic example, but have a problem. The file https://github.com/rackt/redux-simple-router/blob/master/examples/basic/app.js
has a line:
where the
syncHistory()
method is defined inredux-simple-router
but that method does not actually exist, so I can't complete the example.
I tried using the following lines from the readme.md instead
but doing that and when running I get a exception:
cannot read property 'number' of undefined
Any advice what I'm doing wrong?
Here is my actual code (a .tsx file)