vkruglikov / react-telegram-web-app

React components for Telegram Mini Apps
https://www.npmjs.com/package/@vkruglikov/react-telegram-web-app
MIT License
521 stars 64 forks source link

React Hook cannot be called in a class component #63

Closed SantaSpeen closed 9 months ago

SantaSpeen commented 9 months ago

Hello I have problem with useShowPopup() in a class

WARNING in [eslint]
src\components\Form.tsx
  Line 61:26:  React Hook "useShowPopup" cannot be called in a class component. React Hooks must be called in a React function component or a custom React Hook function  react-hooks/rules-of-hooks
vkruglikov commented 9 months ago

You can't use hooks in class components

SantaSpeen commented 9 months ago

Okay, and how i need to call it from class?

vkruglikov commented 9 months ago

@SantaSpeen unfortunately, this package is not for class components. Recommend using functional components