I'm using PHPStorm 8.0.3 for my current project, but unfortunately it doesn't support JSX. In my React components (which are then compiled by Browserify) HTML gets underlined in red and invalidated:
This is just a small component, but it surely gets pretty annoying with bigger ones. Also code formatting doesn't work as expected.
PhpStorm provides code completion for React APIs and JSX in JavaScript code. Code completion works for React methods, React-specific attributes, HTML tags and component names, React events, component properties, and so on. Learn more from the React official website.
IntelliJ IDEA integrates with React providing assistance in configuring, editing, linting, running, debugging, and maintaining your applications.
To check if a string is empty in React, access its length property and check if it's equal to 0 , e.g. if (str. length === 0) {} . If the string's length is equal to 0 , then the string is empty, otherwise it isn't empty. Copied!
Use the Object. keys() method to get an array of the object's keys. Access the length property on the array. If the array of keys has a length of 0 , then the object is empty.
I had the same problem and solution is to either use JSX Harmony on PHPStorm 8:
Preferences / Languages & Frameworks / JavaScript
set JavaScript language version
to JSX Harmony
or move to PHPStorm 9 EAP. I hope PHPStorm 9 will be available soon, though (as I had performance issue with EAP version).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With