So I'm creating a simple react app that export a file that contains a function that returns an array of objects:
export const listStudents = () => {
return [{name:"Ljuben", lastName:"Angelkoski", indeks:"161161", nasoka:"KNI"},
{name:"Pere", lastName:"Anastasov", indeks:"17350", nasoka:"PET"},
{name:"Filip", lastName:"Shabanoski", indeks:"173521", nasoka:"PET"},
{name:"Martin", lastName:"Krsteski", indeks:"163544", nasoka:"KNI"},
{name:"Nikola", lastName:"Nacevski", indeks:"154874", nasoka:"ASI"}]; // replace the empty array with actual array with at least 5 student objects
}
And in my main component I have this code:
import React, {Component} from 'react'
import listStudents from './repository/studentRepository.js'
class Main extends Component{
constructor(props){
super(props);
this.state={
students: listStudents
}
}
render(){
return (
<h2></h2>
)
}
}
export default Main
However when I run the app it gives me this error :
./src/Main.js
Attempted import error: './repository/studentRepository.js' does not contain a default export (imported as 'listStudents').
Any ideas?