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 trial

JavaScript Create Context

Begana Choi
PLUS
Begana Choi
Courses Plus Student 13,126 Points

TypeError: ScoreboardContext.Provider is not a function

I tried the same code on my scoreboard app, I get type error but when I try to run the same code on Guil's download project file, it doesn't get an error. is there any significant change between the last project file and this file? (I'm talking about the file when we built Stopwatch!)

1 Answer

I got this same error. It was because I had put:

const ScoreboardContext = React.createContext;

instead of:

const ScoreboardContext = React.createContext();

createContext() is a function and I wasn't putting the parentheses.