Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a react native app with javascript instead of typescript [duplicate]

I recently tried to crate a new react native app by using the `

npx react-native@latest init AwesomeProject

` command but it created a folder with a app.tsx file.

How can I force it to create a app.js instead? Or can I just replace it with a javascript file? I can't find an awnser to this so hopefully someone can help me.

Greetings

Ben

like image 568
FireKill213 Avatar asked Sep 08 '26 11:09

FireKill213


1 Answers

React native of >=0.71 version considers Typescript as default. You can change the .tsx file to the .js file by changing the file extension and deleting the typescript codes from the file.

But react-native <=0.70 version still considers JavaScript as default. To install react native of <=0.70 you can use the following command on CLI:

npx react-native init <project_name> --version 0.70

Here you can write the version you want.

Official Reference: Using JavaScript Instead of TypeScript

like image 56
Bhavya Koshiya Avatar answered Sep 10 '26 01:09

Bhavya Koshiya



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!