const 只能在 .ts 文件中使用 react native [英] const can only be used in a .ts file react native

查看:69
本文介绍了const 只能在 .ts 文件中使用 react native的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

const ACCESS_TOKEN = 'access_token';

react-native-cli: 2.0.1
react-native: 0.47.2

我正在观看一个教程视频,其中专家从 api 获取值并将其存储在 const ACCESS_TOKEN 中,但是当我在代码中执行此操作时,它给了我一个错误

I am watching a tutorial video in which the expert get the value from the api and stored it inside the const ACCESS_TOKEN but when i am doing it in my code it gives me an error

const 只能在 .ts 文件中使用 react native

const can only be used in a .ts file react native

请提出建议.

推荐答案

const 在类中.把它移到课外,一切都会好起来的.

The const is inside a class. Move it outside the class and all will be ok.

这篇关于const 只能在 .ts 文件中使用 react native的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆