Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VisibleTodoList.js:77 Uncaught TypeError: Cannot read property 'filter' of undefined #5

Open
JoeNoPhoto opened this issue Aug 26, 2016 · 3 comments

Comments

@JoeNoPhoto
Copy link

did you ever run into an issue with { params } in VisibleTodoList.js?

const mapStateToProps = (state, { params }) => {
  console.log('{ params }', { params });
  console.log('params', params);
  console.log('params.filter', params.filter);
  const filter = params.filter || 'all';
  return {
    todos: getVisibleTodos(state, filter),
    filter,
  };
};

I keep getting the following error and assume that the first one is related to the second:
error1:

warning.js:36 Warning: There is an internal error in the React performance measurement code. Did not expect componentDidMount timer to start while render timer is still in progress for another instance.printWarning @ warning.js:36warning @ warning.js:60beginLifeCycleTimer @ ReactDebugTool.js:123onBeginLifeCycleTimer @ ReactDebugTool.js:234invokeComponentDidMountWithTimer @ ReactCompositeComponent.js:58notifyAll @ CallbackQueue.js:67close @ ReactReconcileTransaction.js:81closeAll @ Transaction.js:204perform @ Transaction.js:146batchedMountComponentIntoNode @ ReactMount.js:127perform @ Transaction.js:138batchedUpdates @ ReactDefaultBatchingStrategy.js:63batchedUpdates @ ReactUpdates.js:98_renderNewRootComponent @ ReactMount.js:321_renderSubtreeIntoContainer @ ReactMount.js:402render @ ReactMount.js:423(anonymous function) @ index.js:23(anonymous function) @ bundle.js:47__webpack_require__ @ bundle.js:20(anonymous function) @ bundle.js:40(anonymous function) @ bundle.js:43

error 2

VisibleTodoList.js:77 Uncaught TypeError: Cannot read property 'filter' of undefined

I figure it's something really stupid but can't find it for the life of me. The console.logs above give me the following...

console.log('{ params }', { params });

{ params } > Object {params: undefined}
    params: undefined
    >__proto__: Object

console.log('params', params);

params undefined

console.log('params.filter', params.filter);

warning.js:36 Warning: There is an internal error in the React performance measurement code. Did not expect componentDidMount timer to start while render timer is still in progress for another instance.printWarning @ warning.js:36warning @ warning.js:60beginLifeCycleTimer @ ReactDebugTool.js:123onBeginLifeCycleTimer @ ReactDebugTool.js:234invokeComponentDidMountWithTimer @ ReactCompositeComponent.js:58notifyAll @ CallbackQueue.js:67close @ ReactReconcileTransaction.js:81closeAll @ Transaction.js:204perform @ Transaction.js:146batchedMountComponentIntoNode @ ReactMount.js:127perform @ Transaction.js:138batchedUpdates @ ReactDefaultBatchingStrategy.js:63batchedUpdates @ ReactUpdates.js:98_renderNewRootComponent @ ReactMount.js:321_renderSubtreeIntoContainer @ ReactMount.js:402render @ ReactMount.js:423(anonymous function) @ index.js:23(anonymous function) @ bundle.js:47__webpack_require__ @ bundle.js:20(anonymous function) @ bundle.js:40(anonymous function) @ bundle.js:43
VisibleTodoList.js:79 Uncaught TypeError: Cannot read property 'filter' of undefined

someone referenced this todo app in an issue that was created over in the React repository which gaearon said it'd be fixed in the next release, but that doesn't help at the moment...

@gp3gp3gp3
Copy link

gp3gp3gp3 commented Sep 4, 2016

Yeah I'm getting this bug too. When I run npm install on the lesson branch I get an npm error
No compatible version found: react-router@^3.0.0

@clohr
Copy link

clohr commented Sep 7, 2016

Installing an updated version of react-router fixed it for me. If you update your package.json file with the following line "react-router": "^3.0.0-alpha.1", you should no longer see that error.

@jmoon7
Copy link

jmoon7 commented Jan 19, 2018

For anyone using react router 4, the props passed down are { match, location, history }, and you can get params from match (match.params)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants