Search code examples
javascriptnode.jstypescriptreact-nativeinit

Create a react native app with javascript instead of typescript


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


Solution

  • 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