Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Rendering a component inside another component not working

I have a component called "contactList" and i want to render it inside of another component called "App" but it gives me an error that say "contactList is defined but never used no-unused-vars"

import React, { Component } from 'react';
import './App.css';

class contactList extends Component {
  render(){
    const people = [
      {name: "kester"},
      {name: "john"},
      {name: "mary"}
    ]

     return <ol>
      {people.map(person =>(
        <li key={person.name}>{person.name}</li>
      ))}
     </ol>
  }
}

class App extends Component {
  render(){
    return <div className='App'>
    <contactList/>
  </div>
      
    
  }
}

export default App;

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

React component name must start with capital letter.

So, you need to rename your conatctList component with ContactList.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading