Search code examples
javascripttypescriptreact-native

why my react native become .tsx instead .js


so after installing react native using npx react-native init MyProject the project is running and open in emulator but the app file is not app.js instead app.tsx,

file strcuture

The question is i am new to react native and many tutorial i see is havgin App.js file, and the code in app.js is different between js and tsx at least that's what i see, or is it just the same if i follow tutorial like folder structure, syntax and everything.


Solution

  • That's because of this

    New projects created by the React Native CLI or popular templates like Ignite will use TypeScript by default.

    Read Using JavaScript Instead of TypeScript

    You can just rename your tsx to jsx