Telegram-Mini-Apps/telegram-apps

[Bug]: TypeError: (0 , o.createContext) is not a function

Closed this issue · 1 comments

Telegram Application

Other

Describe the Bug

I'm getting TypeError: (0 , o.createContext) is not a function when trying to use SDKProvider context.

To Reproduce

Steps to reproduce the behavior:

  1. Create Next.js app using npx create-next-app@latest
  2. Install tma.js: npm i @tma.js/sdk @tma.js/sdk-react
  3. Add SDKProvider to root layout.tsx:
  import {SDKProvider} from "@tma.js/sdk-react";
   ...
  <SDKProvider>
    <html lang="en">
      <body className={inter.className}>{children}</body>
    </html>
   </SDKProvider>
  1. Run npm run build

Expected Behavior

Build success.

You should not use SDKProvider in the layout component. Please, refer to the Next.js template.