
Security News
Opengrep Adds Apex Support and New Rule Controls in Latest Updates
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
react-telegram-webapp
Advanced tools
This library can be used to create React UIs in use with the new Telegram WebApp feature. This library use context to feed all your components with the current state of the Telegram props.
This library can be used to create React UIs in use with the new Telegram WebApp feature. This library use context to feed all your components with the current state of the Telegram props.
Wrap your components with a TelegramWebApp
component.
It receives a validateHash
function, which will be called to validate the hash received from Telegram.
import React from 'react';
import ReactDOM from 'react-dom';
import { TelegramWebApp } from 'react-telegram-webapp';
async function validateHash(hash) {
const response = await fetch(`/api/validate`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ hash }),
});
return response.ok;
}
ReactDOM.render(
<TelegramWebApp validateHash={validateHash}>
<MyComponent />
</TelegramWebApp>,
document.getElementById('root')
);
You can also wrap your components with a withTelegramWebApp
function.
It also receives a validateHash
function, which will be called to validate the hash received from Telegram.
import React from 'react';
import { withTelegramWebApp } from 'react-telegram-webapp';
function App() {
return <MyComponent />;
}
async function validateHash(hash) {
const response = await fetch(`/api/validate`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ hash }),
});
return response.ok;
}
export default withTelegramWebApp(App, {
validateHash
});
useStartParam
- return the start params
useTelegramWebApp
- return the TelegramWebApp object
useIsTelegramWebAppReady
- returns true if the TelegramWebApp is ready. You can use this to show loading screen
If you want to contribute to this library, please open an issue or pull request.
FAQs
This library can be used to create React UIs in use with the new Telegram WebApp feature. This library use context to feed all your components with the current state of the Telegram props.
The npm package react-telegram-webapp receives a total of 16 weekly downloads. As such, react-telegram-webapp popularity was classified as not popular.
We found that react-telegram-webapp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.