简体   繁体   中英

WebStorm 2020.3 - how to enable React props intellisense?

I am working on React project and WebStorm is my IDE but I have noticed than whenever I want to write some props for my components I am not getting properly intellisense. I am using Create- React-App and React-CSS-Modules as styling library.

在此处输入图像描述

Checkbox component:

const CheckboxWrapperInner = ({
  isSelected,
  customStyleName = 'checkbox',
  hex6Color = '#221ecc',
  additionalSelectedStyles = {
    borderColor: hex6Color || '#221ecc',
  },
  additionalUnselectedStyles = {
    backgroundColor: 'transparent',
  },
  label,
  onClick = () => {},
}) 

// ... some code

const CheckboxInner = ({...rest}) => {
  return <CheckboxWrapper customStyleName="checkbox" {...rest}></CheckboxWrapper>;
};

const CheckboxWrapper = CSSModules(CheckboxWrapperInner, style, {
  allowMultiple: true,
  handleNotFoundStyleName: 'ignore',
});
export const Checkbox = CSSModules(CheckboxInner, style, {allowMultiple: true});

props completion doesn't work for components with HOC (like export default withStyles(styles)(MyComponent) , etc.). And each HOC requires adding a special support. Related tickets: WEB-38369 , WEB-47862

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM