title: React Http post request to backend nodejs is pending
body: <p>I have a signup backend in nodejs and frontend in nextjs/reactjs</p>
  <p>I see my http post request showing &quot;Pending&quot;. No error message
  <a href="https://i.stack.imgur.com/8KAed.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8KAed.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/MgYQH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MgYQH.png" alt="enter image description here" /></a></p>
  <p>The pending error is pointing to the fetch call here</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import fetch from 'isomorphic-fetch';
  import {API} from '../config';
  
  export const signup = (user) =&gt; {
      return fetch(`${API}/signup`, { ----- Pending pointing here
          method: 'POST',
          headers: {
              Accept: 'application/json',
              'Content-Type': 'application/json'
          },
          body: JSON.stringify(user)
      })
  
      .then(response =&gt; {
          return response.json()
      })
      .catch(err =&gt; console.log(err));
  }</code></pre>
  </div>
  </div>
  </p>
  <p>config.js code</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import getConfig from 'next/config';
  
  const {publicRuntimeConfig} = getConfig();
  
  export const API = publicRuntimeConfig.PRODUCTION
   ? publicRuntimeConfig.API_PRODUCTION
   : publicRuntimeConfig.API_DEVELOPMENT;</code></pre>
  </div>
  </div>
  </p>
  <p>Signup code in Nextjs</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const handleSubmit = e =&gt; {
          e.preventDefault();
          //console.table({firstname, lastname, email, phonenumber, password, confirmpassword,howdidyouknowaboutus, error, loading, message, showForm});
          setValues({...values, loading: true, error: false});
          const user = {firstname, lastname, email, phonenumber, password, confirmpassword,howdidyouknowaboutus};
  
          signup(user)
          .then(data =&gt; {
              
              if(data.error){
                  setValues({...values, error: data.error, loading: false });
              }else{
                  setValues({
                      firstname: '', 
                      lastname: '', 
                      email: '', 
                      phonenumber: '', 
                      password: '', 
                      confirmpassword: '',
                      howdidyouknowaboutus: '', 
                      error: '', 
                      loading: false, 
                      message: data.message, 
                      showForm: false
                  });
              }
              console.log(data);
          });
  
      };</code></pre>
  </div>
  </div>
  </p>
  <p>what is causing this pending? No error in the console.</p>
  <p>Thank you.</p>