title: How to access Object array file into react component?
body: <p>I am trying to access an object array file within src folder eg: data.js(Object array only) this file into my app.js(react component) </p>
  
  <p>in first scenario 1.I have tried this problem using react in </p>
  
  <blockquote>
    <p>src--[app.js(component)/data.js(object array)].    </p>
  </blockquote>
  
  <p>When I was run it shows me an error like </p>
  
  <blockquote>
    <p>(TypeError: _data__WEBPACK_IMPORTED_MODULE_1___default.a.map is not a function)means null array/undefined.</p>
  </blockquote>
  
  <p>in second scenarios 2. when I add object array in app.js within the same page its shows me perfect result. without an error but trying from another file like data.js it taking null array I have used to <code>stringify()</code> and JSON parser but no result</p>
  
  <p>Object array file data.js -></p>
  
  <pre><code>const datas=[
      {
      "id":"1",
      "firstname":"sam",
      "lastname":"parkar"
      },
      {
      "id":"2",
      "firstname":"julee",
      "lastname":"fransic"
      }
      ];
  </code></pre>
  
  <p>react component app.js -></p>
  
  <pre><code>import React from 'react';
  import  datas from './data';
  import  DataInfo from './DataInfo';
  function App () {
   const appdata=datas.map( inner =&gt; inner.id + inner.firstname + inner.lastname)
  //print on console
   console.log(appdata)
      return (
       &lt;div className="App"&gt;
             &lt;p&gt;App js page&lt;/p&gt;
  
                {appdata} 
  
        &lt;/div&gt;
      )
    }
  export default App;
  </code></pre>
  
  <p>error ->  </p>
  
  <pre><code>TypeError: _data__WEBPACK_IMPORTED_MODULE_1___default.a.map is not a function
    21 | return (  
    22 |   
    23 |   
  &gt; 24 |   &lt;div className="App"&gt;  
       |  ^  25 |   
    26 |        &lt;p&gt;App js page&lt;/p&gt;  
  </code></pre>
  
  <p>actual result:-<br>
  App js page</p>
  
  <blockquote>
    <p>1samparkar2juleefransic<br>
    and on console
    (2) ["1samparkar", "2juleefransic"]
    0: "1samparkar"
    1: "2juleefransic"</p>
  </blockquote>