For those using Next.js: you may get this error if you don't add 'use client' at the beginning of the file consuming context.
'use client'