Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
196 views
in Technique[技术] by (71.8m points)

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

const ACCESS_TOKEN = 'access_token';

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

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 can only be used in a .ts file react native

Please suggest.

question from:https://stackoverflow.com/questions/45917365/const-can-only-be-used-in-a-ts-file-react-native

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...