title: React _services_persons__WEBPACK_IMPORTED_MODULE_3__.default.getAll(...)
body: <p>I have the following module:</p>
  
  <pre><code>import axios from 'axios'
  const url = 'http://localhost:3001/persons'
  
  const getAll = () =&gt; {
      axios.get(url).then(response =&gt; {
          return response.data
      })
  }
  
  const create = newPerson =&gt; {
      axios.post(url, newPerson).then(response =&gt; {
          return response.data
      })
  }
  
  const remove = id =&gt; {
      axios.delete(`${url}/${id}`).then(response =&gt; {
          return response.data
      })
  }
  
  export default { getAll, create, remove }
  </code></pre>
  
  <p>That I import with the following line:</p>
  
  <pre><code>import personService from './services/persons'
  </code></pre>
  
  <p>And when the variable <code>personService</code> is called:</p>
  
  <pre><code>useEffect(() =&gt; {
      console.log(personService)
      personService.getAll()
          .then(allPersons =&gt; {
              setPersons(allPersons)
          })
  }, [])
  </code></pre>
  
  <p>I have the following error:</p>
  
  <p><strong><em>TypeError: _services_persons__WEBPACK_IMPORTED_MODULE_3__.default.create(...) is undefined</em></strong></p>
  
  <p>Note that the <code>console.log(personService)</code> display the following in the console:</p>
  
  <pre><code>    {…}
  ​    create: create()
  ​      length: 1
  ​      name: "create"
  ​​      &lt;prototype&gt;: function ()
      getAll: getAll()
  ​​      length: 0
  ​​      name: "getAll"
  ​​      &lt;prototype&gt;: function ()
  ​    remove: remove()
  ​​      length: 1
  ​​      name: "remove"
  ​​      &lt;prototype&gt;: function ()
  ​
  </code></pre>
  
  <p>my react versions are the following:</p>
  
  <ul>
  <li>"react": "^16.8.6",</li>
  <li>"react-dom": "^16.8.6",</li>
  <li>"react-scripts": "3.0.1"</li>
  </ul>