In SPFx No JavaScript Framework webpart contain "webpart.ts" file and write code in it.

But in React SPFx webpart, there are 2 file :

1) webpart.ts file
2) webpart.tsx file in component folder.

Can any buddy explain what can we do with webpart.ts file and webpart.tsx file ?


  • Do you require any further details from my answer? – James Randal Jan 15 at 2:51

TSX allows for embedding JSX elements inside the file, and is largely used by React.

TS files are plain old Typescript files and do not support adding JSX Elements.

Typically you would seperate concerns by placing only code relating to presentation in the TSX files.

The following link is useful for understanding some of the key differences


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.