QuizNot attempted
useContext with no provider and no default
1–4 to choose, Enter to submit
Show answer & explanation
Correct answer:
<p></p>(rendersundefined, i.e., nothing visible)
- With no Provider above,
useContextreturns the default passed tocreateContext() - nothing was passed, so it is
undefined, and React renders nothing forundefined: an empty<p>. - Not 'throws': a missing provider is not an error (custom hooks often throw on purpose).
- Not null: null also renders nothing, but the value is undefined.
- Not 0: that would need
createContext(0).