title: Reactjs - TypeError: Failed to execute 'fetch' on 'Window': Failed to parse URL from ***.**.*.***:2000
body: <p>This is my reactjs code and I am having problem with fetch. I have created own api using nodejs and trying to retrieve some demo json using get method. I am using same local IP for both reactjs and nodejs, yes i am using different port.</p>
  <pre><code>import React, { Component } from 'react';
  import ReactDOM from 'react-dom';
  
  class App extends Component {
      constructor(props) {
          super(props);
          this.state = {
              error: null,
              isLoaded: false,
              items: []
          };
      }
  
      componentDidMount() {
          fetch(' ***.**.*.***:2000', {
              method: 'GET'
          })
              .then(res =&gt; res.json())
              .then(
                  (result) =&gt; {
                      this.setState({
                          isLoaded: true,
                          items: result
                      });
                      console.log(result);
                  },
                  (error) =&gt; {
                      this.setState({
                          isLoaded: true,
                          error
                      });console.log(error)
                  }
              )
      }
      render() {
              return (
                  &lt;ul&gt;fdg
  {/*                    {this.state.items.map(item =&gt; (
                          &lt;li key={item.id}&gt;
                              {item.name}
                          &lt;/li&gt;
                      ))}*/}
                  &lt;/ul&gt;
              );
  
      }
  }
  ReactDOM.render(
      &lt;App /&gt;,
      document.getElementById('root')
  );
  </code></pre>
  <p>Error is shown after fetch is failed</p>
  <pre><code>  TypeError: Failed to execute 'fetch' on 'Window': Failed to parse URL
   from  ***.**.*.***:2000
           at App.componentDidMount (index.js:15)
           at commitLifeCycles (react-dom.development.js:14361)
           at commitAllLifeCycles (react-dom.development.js:15462)
           at HTMLUnknownElement.callCallback (react-dom.development.js:100)
           at Object.invokeGuardedCallbackDev (react-dom.development.js:138)
           at invokeGuardedCallback (react-dom.development.js:187)
           at commitRoot (react-dom.development.js:15603)
           at completeRoot (react-dom.development.js:16618)
           at performWorkOnRoot (react-dom.development.js:16563)
           at performWork (react-dom.development.js:16482)
           at performSyncWork (react-dom.development.js:16454)
           at requestWork (react-dom.development.js:16354)
           at scheduleWork$1 (react-dom.development.js:16218)
           at scheduleRootUpdate (react-dom.development.js:16785)
           at updateContainerAtExpirationTime (react-dom.development.js:16812)
           at updateContainer (react-dom.development.js:16839)
           at ReactRoot../node_modules/react-dom/cjs/react-dom.development.js.ReactRoot.render
   (react-dom.development.js:17122)
           at react-dom.development.js:17262
           at unbatchedUpdates (react-dom.development.js:16679)
           at legacyRenderSubtreeIntoContainer (react-dom.development.js:17258)
           at Object.render (react-dom.development.js:17317)
           at Object../src/index.js (index.js:48)
           at __webpack_require__ (bootstrap d08df1f09c74587853fb:678)
           at fn (bootstrap d08df1f09c74587853fb:88)
           at Object.0 (index.js:49)
           at __webpack_require__ (bootstrap d08df1f09c74587853fb:678)
           at ./node_modules/ansi-regex/index.js.module.exports (bootstrap d08df1f09c74587853fb:724)
           at bootstrap d08df1f09c74587853fb:724
  </code></pre>