syntax highlighting for react code in sublime
- Step 1 - Go to Package Control ( ctrl + shift + p)
- Step 2 - Select install package
- Step 3 - Search for JSX plugin and install it.
- Step 4 - Then set the JSX syntax in Sublime3 Editor from: View > Syntax > JSX.
Use filename with .jsx
extension
You need to install babel-sublime
plugin.
You can install it from package control
of sublime.
Here is the link - https://github.com/babel/babel-sublime
Installing babel fixes the syntax highlighting.
Steps to install babel on sublime3:
- For windows: Press Ctrl+Shift+P For mac: Cmd+Shift+P
- Then type
install
and selectPackage control: Install Package
- Then type
Babel
and select'Babel-Snippets'
. It will install babel in few moments. - Then set the Babel syntax in Sublime3 Editor from:
View > Syntax > Babel > Javascript
For some users, Babel
was missing in step 4. They can additionally install Babel
by following the same steps and selecting Babel
this time instead of Babel-Snippets
in step3.
Check I tested it: