YardenST
YardenST

Reputation: 5257

WebStorm doesn't recognise use of components inside JSX

Say I'm importing a component:

const MyComponent   = require('./components/MyComponent');

And then use it inside JSX block:

const App = props => (<MyComponent/>)

I get an error from Eslint in WebStorm:

'MyComponent' is assigned a value but never used (no-unused-vars)

How do I make WebStorm to understand I'm using this variable?

Upvotes: 1

Views: 834

Answers (1)

lena
lena

Reputation: 93728

It's not WebStorm but ESLint that doesn't recognize your JSX variable. Do you have eslint-plugin-react installed? I guess you are missing the jsx-uses-vars rule. See https://github.com/eslint/eslint/issues/2156, https://github.com/hyperapp/hyperapp/issues/557 for some hints

Upvotes: 3

Related Questions