DEV Community

Discussion on: Complex app w/ React

zoedreams profile image
☮️✝️☪️🕉☸️✡️☯️ • Edited

profileData or counts is undefined or null. Its a good practice to get into not chaining properties like that unless you're using ECMA7+ which does automatic inline null checks.

Glad you solved it. After reviewing the code i would recommend putting the stuff that sets the profileData into its own function and make sure to use a try catch to throw and error or something. This would make your code more extensible for unit testing.