Jim Lynch Codes
  • Blog
  • About Jim

Writings about one coder's stories & experiences.

Configuring WebStorm 2016 to Use JSX

6/11/2016

0 Comments

 
This is a post about setting up WebStorm to understand JSX and work for React projects. 
I've started to play with the yeoman generators out there for React, and for a larger-small project like that I really wanted to open it in WebStorm. Of course being written by hardcore React developers, these generated projects all use JSX. In reality, it's not possible to get proficient with React without using JSX because it is in literally all the projects. When in Rome, do it the way the Romans do. Even if you don't understand right now why JSX is better than straight JavaScript, trust that it is (or read this blog post). BUT, I have a problem. My tooling is confused because I'm using JSX for the first time. :) As usual, I just hit File -> Open, and navigate to the root directory of my project. When opening a React project in WebStorm for the first time you might get error messages from your JSX code like this:
Picture
Picture
Also check if you are getting "Your current JavaScript version does not support this" errors. This means that you need to change the "JavaScript language version" to JSX Harmony. Go to Webstorm -> Preferences -> Languages & Frameworks -> JavaScript to JSX Harmony.
Picture
Now your React code should have pretty highlighting and the error messages should be gone!

The Other Options

  • Prefer Strict mode - Strict mode is basically equivalent to declaring 'use strict' in your JavaScript files, but the IDE will enforce it even if you don't write 'use strict'! I like using 'use strict' because it allows the IDE to tell you when you make mistakes that could otherwise cause runtime errors and issues with your application. If you forget when 'use strict' does check the Mozilla docs or this stack overflow post. So go ahead and check this box. :)
  • Only type-based completion - WebStorm is a unique JavaScript editor in that it can give you hinting and code completion for your JavaScript objects! Sometimes though, you might find that you'll hit command + space, and then the intellisense popup box will give you every possible variable in every library in your project. Ahh! Keep this box checked, and your intellisense popups should be short and useful. :)
Picture
0 Comments

Your comment will be posted after it is approved.


Leave a Reply.

    ​Author

    Picture
    The posts on this site are written and maintained by Jim Lynch. About Jim...
    Picture
    Follow @JimLynchCodes
    Follow @JimLynchCodes

    Categories

    All
    Actionscript 3
    Angular
    AngularJS
    Automated Testing
    AWS Lambda
    Behavior Driven Development
    Blockchain
    Blogging
    Business Building
    C#
    C / C++
    ClojureScript / Clojure
    Coding
    Community Service
    CS Philosophy
    Css / Scss
    Dev Ops
    Firebase
    Fitness
    Flash
    Front End
    Functional Programming
    Git
    Go Lang
    Haskell
    Illustrations
    Investing
    Java
    Javascript
    Lean
    Life
    Linux
    Logic Pro
    Music
    Node.js
    Planning
    Productivity
    Professionalism
    Python
    React
    Redux / Ngrx
    Refactoring
    Reusable Components
    Rust
    Security
    Serverless
    Shell Scripting
    Swift
    Test Driven Development
    Things
    TypeScript
    Useful Sites
    Useful Tools
    Video
    Website Development
    WebStorm
    Writing

    Archives

    March 2023
    August 2021
    February 2021
    January 2021
    October 2020
    September 2020
    May 2020
    April 2020
    February 2020
    January 2020
    December 2019
    October 2019
    September 2019
    August 2019
    July 2019
    June 2019
    May 2019
    April 2019
    March 2019
    February 2019
    January 2019
    December 2018
    November 2018
    October 2018
    September 2018
    August 2018
    June 2018
    May 2018
    April 2018
    March 2018
    February 2018
    January 2018
    December 2017
    November 2017
    October 2017
    September 2017
    August 2017
    July 2017
    May 2017
    April 2017
    March 2017
    February 2017
    January 2017
    December 2016
    November 2016
    October 2016
    September 2016
    August 2016
    July 2016
    June 2016
    May 2016
    April 2016
    March 2016
    February 2016
    January 2016
    December 2015
    November 2015
    October 2015

    RSS Feed

  • Blog
  • About Jim
JimLynchCodes © 2023