Reputation: 319
TypeError: undefined is not an object (evaluating '_kurals.default.length')
i got this error.
export const kurals =[];
import kurals from './kurals';
console.log(`data1.length`, kurals.length);
Upvotes: 0
Views: 953
Reputation: 1409
If you want to import it as a default, like you did with import kurals from './kurals';
, then it must be exported as default:
export default [];
Since you exported it with export const kurals = [];
then it's a property of the exported object and you need to destructure it:
import { kurals } from './kurals';
Upvotes: 1