What is the difference between .ts and .tsx extensions. Both are used as extensions for typescript files in react. So where should we use them?

Use .ts for pure TypeScript files.

Use .tsx for files which contain JSX.

For example, a React component would be .tsx, but a file containing helper functions would be .ts.

Leave a Comment