Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBrandyn Lordi
17,778 Pointshow to log React.createContext() to the console?
at 0:45 Guil logged the value of const ScoreboardContext = React.createContext()
to the console. When i log ScoreboardContext
to the console, i get an undefined error.
Any idea what I might be missing?
1 Answer
Brandyn Lordi
17,778 PointsOver a year later i return to this course and came up with the same question only to discover my own unanswered question! I have an answer now for anyone that might be wondering...
Simply add:
import {ScoreboardContext} from './context'
to app.js
then add:
console.log(ScoreboardContext)
somewhere in the render function, before the return statement.
Erland Van Olmen
Full Stack JavaScript Techdegree Graduate 17,825 PointsErland Van Olmen
Full Stack JavaScript Techdegree Graduate 17,825 PointsFor the above to work, you also need to export the ScoreboardContext like so: