i try to import a array data in JS file from another js file in react native , and i try to check the length of the array in react native
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);
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';