title: How do I get the ID of an object from mongodb database in my react application?
body: <p>I am learning by building. I am building a blog management system using Reactjs, Nodejs, Mongodb.
  I would like to store some frontend values in the database so that anyone I give admin permission can post, edit and delete such values. These values are website name, sub-name, sidebar bio description, header image and bio image.</p>
  <p>This is the code to create the value:</p>
  <pre><code>//create new frontend paramters into database
  router.post(&quot;/&quot;, async (req, res) =&gt;{
  const newFrontendValues = new Frontend(req.body);//we called the    frontend model we created and we used req.body
  
  try{
      const savedFrontendValues = await newFrontendValues.save()//we tried to save the frontend values created
    
      
      res.status(200).json(savedFrontendValues)
  }catch(err){
     res.status(500).json(err)
  }
  
  }); 
  </code></pre>
  <p>I wrote the code in node to get the values like this after creating them:</p>
  <pre><code>//get frontend parameters
  router.get(&quot;/:id&quot;, async (req, res) =&gt;{
  try{
      const frontend = await Frontend.findById(req.params.id)
      res.status(200).json(frontend)
  }catch(err){
      res.status(500).json(err)
  }
  })
  </code></pre>
  <p>my server api code</p>
  <pre><code>app.use(&quot;/api/frontend&quot;, frontend)
  </code></pre>
  <p>In react, I wanted to call the _id of the values but I am lost. I really don't know how to go about that.
  It is working fine as desired in postman because I can directly implement the value _id.
  See attached image
  <a href="https://i.stack.imgur.com/b8NZN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b8NZN.png" alt="enter image description here" /></a></p>
  <p>But in React, I wanted that to be dynamic.</p>
  <p>Here is my React code:</p>
  <pre><code> useEffect(() =&gt; {
    const fetchFrontendValue = async () =&gt;{
        const res = await axios.get(&quot;/frontend&quot;)
        console.log(res.data)
    }
   fetchFrontendValue()
   }, [])
  </code></pre>
  <p>How do I add the _id to this</p>
  <pre><code>axios.get(&quot;/frontend&quot;)
  </code></pre>