I have two files
Description.js and subjects.js Subject.js file contains an array of subjects
export const Subjects=[ { id:1, title:"Mathematics", text:"Cheat Sheet for Mathematics", img:"./Images/math.jpg", }, { id:2, title:"C-programming", text:"Cheat Sheet for C-Programming", img:"./Images/cprog.jpg", }, { id:3, title:"Physics", text:"Cheat Sheet for Physics", img:"./Images/physics.jpg", }, { id:4, title:"Youtube", text:"Recomended Youtube videos for Learning", img:"./Images/youtube.jpg", }, ] I want to use this array in Description.js .I'm using a map function
import React, { Component } from 'react'; import {Subjects} from './subjects' class Description extends Component{ constructor(props){ super(props); } render(){ const description =this.props.Subjects.map((subjects)=>{ return( <h1>{subjects.title}</h1> ) }) return( {description} ) } } export default Description; But I am recieving an error of
TypeError: Cannot read property 'map' of undefined Also in my vs code terminal.I have these mentioned
Line 2:9: 'Subjects' is defined but never used no-unused-vars Line 5:5: Useless constructor no-useless-constructor