title: How to connect docker-compose with react and spring boot
body: <p>I have a question. I have created simple React and Spring-Boot applications and created dockerfiles for both. Spring-Boot displays some API and React makes requests to it. However, both of them works on ports (React - 3000 and Spring-Boot - 8080). When I made a request, I have my fetch sth like this:</p>
  
  <pre><code>fetch("http://localhost:8080/projects")
  </code></pre>
  
  <p>How am I supposed to change this, in order to work it with docker-compose? Because when I export ports in docker-compose file this fetch make requests inside the container, not outside of it.</p>
  
  <p>docker-compose:</p>
  
  <pre><code>version: '3'
  services:
    frontend:
      image: "IMAGE/FRONTEND:latest"
      ports:
        - "3000:3000"
      depends_on:
        - backend
    backend:
      image: "IMAGE/BACKEND:latest"
      ports:
        - "8080:8080"
  </code></pre>