I am a beginner
I want to create a telegram mini app .
According to the telegram API documentation I put follow link into head of index.html of React Project
<script src="https://telegram.org/js/telegram-web-app.js"></script>
But in app.js component when I use console.log(window.Telgram.WebApp.initDataUnsafe);
,I get following error in the inspector of telegram beta inspector :
main.4187b710.js:2
TypeError: Cannot read properties of undefined (reading ‘WebApp’)
at s (main.4187b710.js:2:143197)
at vo (main.4187b710.js:2:60543)
at xi (main.4187b710.js:2:120194)
at bs (main.4187b710.js:2:109300)
at gs (main.4187b710.js:2:109228)
at vs (main.4187b710.js:2:109091)
at as (main.4187b710.js:2:105871)
at ls (main.4187b710.js:2:104422)
at S (main.4187b710.js:2:138324)
at MessagePort.T (main.4187b710.js:2:138858)
fu @ main.4187b710.js:2
main.4187b710.js:2
Uncaught
TypeError: Cannot read properties of undefined (reading ‘WebApp’)
at s (main.4187b710.js:2:143197)
at vo (main.4187b710.js:2:60543)
at xi (main.4187b710.js:2:120194)
at bs (main.4187b710.js:2:109300)
at gs (main.4187b710.js:2:109228)
at vs (main.4187b710.js:2:109091)
at as (main.4187b710.js:2:105871)
please help me
React component recognize window.telegram.window.Telgram.WebApp
Eng.Ali karimifard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.