title: does not execute useEffect() error TypeError: Cannot read properties of undefined (reading 'toString')
body: <p>hello friends I have a problem in an application in react JS that is driving me crazy and I don't know how to solve it, I am making a call with axios to obtain information which I have already tried with postman and the backend works perfectly the issue is that I don't know this executing the useEffect() where I am making that call to fill a useState and pass that object by props to a child component. below sent code and error . thank you very much for any help you can give me I'm starting with react</p>
  <pre><code>import React, { Fragment, useState, useEffect } from 'react';
  import Breadcrumb from '../../common/breadcrumb';
  
  import InfoGeneralQueja from './components/InfoGeneralQueja'
  import InfoCalidadQueja from './components/InfoCalidadQueja'
  import InfoDirectorQueja from './components/InfoDirectorQueja'
  
  import axios from &quot;axios&quot;;
  import { useNavigate, useParams } from &quot;react-router-dom&quot;;
  
  
  
  
  
  
  const QuejaDetalle = () =&gt; {
      const [detalle, setDetalle] = useState([])
      //id params
      const { id } = useParams()
      console.log(&quot;ID: &quot;, id)
  
      //User
      const user = JSON.parse(localStorage.getItem('user'))
  
      //end point
      const endpoint = 'http://localhost:5000/detalle/'
  
      //Data
      const getQuejaById = async () =&gt; {
          const res = await axios.get(endpoint + id)
          .then(function (response) {
              setDetalle(JSON.stringify(response.data))
           }).catch(function (error) {
              console.log(error.response);
          });
          
      }
      //Triggered
      useEffect(() =&gt; {getQuejaById()},[])
     
  
  
  
      return (
          &lt;Fragment&gt;
              &lt;Breadcrumb title={`Detalles Evento`} parent=&quot;Quejas&quot; /&gt;
              &lt;div className=&quot;container-fluid&quot;&gt;&lt;/div&gt;
              &lt;div className=&quot;row&quot;&gt;
                  &lt;InfoGeneralQueja quejaData={detalle} /&gt;
                  &lt;InfoCalidadQueja quejaData={detalle} user={user} /&gt;
                  &lt;InfoDirectorQueja quejaData={detalle} user={user} /&gt;
              &lt;/div &gt;
          &lt;/Fragment &gt;
      )
  }
  
  export default QuejaDetalle
  
  
  
  //////////////////// Error ///////////////////////////////
  
  InfoGeneralQueja.js:32 Uncaught TypeError: Cannot read properties of undefined (reading 'toString')
      at InfoGeneralQueja (InfoGeneralQueja.js:32:1)
      at renderWithHooks (react-dom.development.js:14985:1)
      at mountIndeterminateComponent (react-dom.development.js:17811:1)
      at beginWork (react-dom.development.js:19049:1)
      at HTMLUnknownElement.callCallback (react-dom.development.js:3945:1)
      at Object.invokeGuardedCallbackDev (react-dom.development.js:3994:1)
      at invokeGuardedCallback (react-dom.development.js:4056:1)
      at beginWork$1 (react-dom.development.js:23964:1)
      at performUnitOfWork (react-dom.development.js:22776:1)
      at workLoopSync (react-dom.development.js:22707:1)
  InfoGeneralQueja @ InfoGeneralQueja.js:32
  renderWithHooks @ react-dom.development.js:14985
  mountIndeterminateComponent @ react-dom.development.js:17811
  beginWork @ react-dom.development.js:19049
  callCallback @ react-dom.development.js:3945
  invokeGuardedCallbackDev @ react-dom.development.js:3994
  invokeGuardedCallback @ react-dom.development.js:4056
  beginWork$1 @ react-dom.development.js:23964
  performUnitOfWork @ react-dom.development.js:22776
  workLoopSync @ react-dom.development.js:22707
  renderRootSync @ react-dom.development.js:22670
  performSyncWorkOnRoot @ react-dom.development.js:22293
  scheduleUpdateOnFiber @ react-dom.development.js:21881
  updateContainer @ react-dom.development.js:25482
  (anonymous) @ react-dom.development.js:26021
  unbatchedUpdates @ react-dom.development.js:22431
  legacyRenderSubtreeIntoContainer @ react-dom.development.js:26020
  render @ react-dom.development.js:26103
  ./src/index.js @ index.js:74
  options.factory @ react refresh:6
  __webpack_require__ @ bootstrap:24
  (anonymous) @ startup:7
  (anonymous) @ startup:7
  react-dom.development.js:20085 The above error occurred in the &lt;InfoGeneralQueja&gt; component:
  
      at InfoGeneralQueja (http://localhost:3000/static/js/bundle.js:2509:24)
      at div
      at div
      at QuejaDetalle (http://localhost:3000/static/js/bundle.js:4061:66)
      at Outlet (http://localhost:3000/static/js/bundle.js:143525:26)
      at div
      at div
      at div
      at AppLayout (http://localhost:3000/static/js/bundle.js:1132:66)
      at Routes (http://localhost:3000/static/js/bundle.js:143624:24)
      at Router (http://localhost:3000/static/js/bundle.js:143549:30)
      at BrowserRouter (http://localhost:3000/static/js/bundle.js:142986:23)
      at Provider (http://localhost:3000/static/js/bundle.js:140426:20)
      at div
      at Root (http://localhost:3000/static/js/bundle.js:15107:51)
  
  Consider adding an error boundary to your tree to customize error handling behavior.
  Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.
  logCapturedError @ react-dom.development.js:20085
  update.callback @ react-dom.development.js:20118
  callCallback @ react-dom.development.js:12318
  commitUpdateQueue @ react-dom.development.js:12339
  commitLifeCycles @ react-dom.development.js:20736
  commitLayoutEffects @ react-dom.development.js:23426
  callCallback @ react-dom.development.js:3945
  invokeGuardedCallbackDev @ react-dom.development.js:3994
  invokeGuardedCallback @ react-dom.development.js:4056
  commitRootImpl @ react-dom.development.js:23151
  unstable_runWithPriority @ scheduler.development.js:468
  runWithPriority$1 @ react-dom.development.js:11276
  commitRoot @ react-dom.development.js:22990
  performSyncWorkOnRoot @ react-dom.development.js:22329
  scheduleUpdateOnFiber @ react-dom.development.js:21881
  updateContainer @ react-dom.development.js:25482
  (anonymous) @ react-dom.development.js:26021
  unbatchedUpdates @ react-dom.development.js:22431
  legacyRenderSubtreeIntoContainer @ react-dom.development.js:26020
  render @ react-dom.development.js:26103
  ./src/index.js @ index.js:74
  options.factory @ react refresh:6
  __webpack_require__ @ bootstrap:24
  (anonymous) @ startup:7
  (anonymous) @ startup:7
  InfoGeneralQueja.js:32 Uncaught TypeError: Cannot read properties of undefined (reading 'toString')
      at InfoGeneralQueja (InfoGeneralQueja.js:32:1)
      at renderWithHooks (react-dom.development.js:14985:1)
      at mountIndeterminateComponent (react-dom.development.js:17811:1)
      at beginWork (react-dom.development.js:19049:1)
      at HTMLUnknownElement.callCallback (react-dom.development.js:3945:1)
      at Object.invokeGuardedCallbackDev (react-dom.development.js:3994:1)
      at invokeGuardedCallback (react-dom.development.js:4056:1)
      at beginWork$1 (react-dom.development.js:23964:1)
      at performUnitOfWork (react-dom.development.js:22776:1)
      at workLoopSync (react-dom.development.js:22707:1)
  </code></pre>