Home > OS >  Eslint doesnt see React components in use
Eslint doesnt see React components in use

Time:12-11

I have been creating fresh react project. I cant run test component

import './App.css';
import {test} from './test';
import React, {Component} from 'react';
export default class App extends Component{
  render = () =>
    <div><test/></div>
  
}

Compiled with warnings.

src\App.js Line 3:9: 'test' is defined but never used no-unused-vars

Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.

CodePudding user response:

React components should be capitalized. Try

import { test as Test } from './test';
...
<div><Test/></div>
  • Related