bradtraversy / lead_manager_react_django

Full stack app with React, Redux & Django
592 stars 316 forks source link

Video 3: getLeads and leads is undefined #3

Closed heyvidy closed 5 years ago

heyvidy commented 5 years ago

Im currently working through video 3 and setting up redux and I cant seem to debug a set of error. The files match the tutorial. I've double checked that with this repo as well.

Can you please help me with this?

2019-02-23 21_18_07-cmd - pipenv shell - python manage py runserver admin

To make it to refer my work, Here's the link to my repo of work so far: https://github.com/justvidyadhar/lead-manager

LeoSko commented 5 years ago

Okay, after 3 hours of looking into your code and figuring out I got it. In your Dashboard.js import { Leads } from './Leads'; In original Brad's Dashboard.js import Leads from "./Leads";

Those brackets make huge difference here, look more description here and there. Basically, in your code you import class Leads instead of result of connect(mapStateToProps, { getLeads })(Leads);. This difference in import lead to undefined props that are usually set in connect(), that's what error says.

Fix the import and you should be fine.

jjgarrett0 commented 5 years ago

@LeoSko Thank you for finding that! I have been following along as well but modifying for my own application (essentially replacing "leads" with "stations") and I couldn't figure out what was going wrong. This just saved me hours of frustration!! Thanks so much!

NeilFranks commented 5 years ago

@LeoSko dude thank you