JSX & React support
You can write JSX syntax in Visual Studio with full Intellisense support.
With JavaScript
If you're using JavaScript, you can use JSX syntax in either .js or .jsx files. You'll automatically see Intellisense for the latest version of React when in a .jsx file, or if a .jsx file is anywhere in your project.
Primary documentation for this feature can be found at the Microsoft docs page for JavaScript in Visual Studio (see section "JSX syntax support").
With TypeScript
JSX syntax is supported in TypeScript when the file's extension is .tsx.
You can also use a custom JSX types package (i.e. one other than @types/react
) and specify a different JSX emit when targeting non-React JSX frameworks.
See the TypeScript React starter project in the Additional Resources section for more information.
Additional Resources
- https://reactjs.org/docs/hello-world.html - React documentation
- https://www.typescriptlang.org/docs/handbook/jsx.html - JSX in the TypeScript Handbook
- https://www.typescriptlang.org/docs/handbook/react-&-webpack.html - React and webpack in the TypeScript Handbook
- https://basarat.gitbooks.io/typescript/docs/jsx/tsx.html - TSX in the TypeScript Deep Dive
- https://github.com/Microsoft/TypeScript-React-Starter - A starter project for using TypeScript and React
- https://javascriptplayground.com/blog/2017/04/react-typescript/ - Setting up webpack with yarn and tslint for TypeScript
- https://medium.com/@fay_jai/getting-started-with-reactjs-typescript-and-webpack-95dcaa0ed33c - A walkthrough for setting up React and TypeScript
- https://spin.atomicobject.com/2017/10/31/react-typescript-basics/ - Another walkthrough
- http://www.jbrantly.com/typescript-and-jsx/ - Overview of JSX with TypeScript
- http://blog.mgechev.com/2015/07/05/using-jsx-react-with-typescript/ - Another blog post about JSX and TypeScript