title: How to send parameters through axios get method in react?
body: <p>I have a axios GET method and I need to pass parameters with the get request. I am calling the GET method in Client side (React.js) like this,</p>
  
  <pre><code>    const [Cart] = useState([]);
      const user = {
          userId : session.userId
      };
  
      console.log(user);
      useEffect((user) =&gt; {
          if(session.userId !== null){
  
              //Axios.get('http://localhost:5000/api/cart/getCart', user) &lt;- I tried both these ways
              Axios({
                  method: 'GET',
                  url: 'http://localhost:5000/api/cart/getCart',
                  headers: {
                      'Content-Type': 'application/json',
                      'Accept': 'application/json'
                  },
                  data: {},
                  params: {
                      "userId" : session.userId
                  }
              })
                  .then(res =&gt; {
                      const cart = res.data;
  
                      let tempProducts = [];
                      cart.data.forEach(item =&gt; {
                          const singleItem = {...item};
                          tempProducts = [...tempProducts, singleItem];
                      });
  
                      this.setState(() =&gt; {
                          return {Cart: tempProducts};
                      });
  
                  })
          }
          console.log(Cart)
      });
  </code></pre>
  
  <p>But in server side (node.js), it doesn't get the parameter value.</p>
  
  <pre><code>router.get('/getCart', (req, res) =&gt; {
  
      console.log(req.body.userId) //This gives the output as undefined
      User.findOne({_id: req.body.userId}
      ,(err, userInfo) =&gt; {
  
         res.json(userInfo.Cart);
  
      })
  });
  </code></pre>
  
  <p>I implemented the uncommented axios.get request by referring to <a href="https://stackoverflow.com/a/60071790/13353216">this</a>. Can you please help me to find the error? Or can you suggest me any other method to do this? Thanks</p>