React component for Telegram Web Apps (TWA) Main Button
npm install @twa-dev/mainbutton> DEPRECATED
>
> MainButton moved to @twa-dev/sdk. This repo and corresponding npm-package are deprecated.
React component for Telegram Web Apps (TWA) Main Button.
```
npm i @twa-dev/mainbutton
`js
const MainButton = window.Telegram.WebApp.MainButton;
MainButton.setText('Submit');
MainButton.show();
MainButton.onClick(() => alert('submitted'));
`
It's not the best way to write code, especially if you use libraries like React.
This package exports React component that wraps TWA MainButton SDK:
`js
import MainButton from '@twa-dev/mainbutton';
`
- color
- textColor
- disabled
- progress
- onClick`