title: ASP.NET Core React project template - how to link to C# backend
body: <p>I am trying to learn how to create React applications with ASP.NET Core. Helpfully they provide the React project template which some examples that enable me to see how everything is working together. However, in order to make sure I fully understand, I want to add my own code. I'm starting v. small with "Hello World" - I just want this displayed on the home page. </p>
  
  <p>Here is my home.js file: </p>
  
  <pre><code>import React, { Component } from 'react';
  
  export class Home extends Component {
  static displayName = Home.name;
  
     constructor(props) {
        super(props);
        this.state = { message: "" };
  
          fetch('Home/Index')
             .then(res =&gt; res.json())
             .then((result) =&gt; {
             this.setState({ message: result.message });
           });
      }
  
          render () {
           return (
             &lt;div&gt;
               &lt;h1&gt;Message:{this.state.message}&lt;/h1&gt;
             &lt;/div&gt; 
          );
      }
  }
  
  </code></pre>
  
  <p>Here is my backend code that I want to be rendered on the home page:
  HomeController.cs:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Threading.Tasks;
  using Microsoft.AspNetCore.Mvc;
  
  
  namespace TestingReactDotNet.Controllers
  {
      public class HomeController : Controller
      {
          // GET: /&lt;controller&gt;/
          public string Index()
          {
              return "Hello World";
          }
      }
  }
  
  </code></pre>
  
  <p>My question is - what do I <code>return()</code> in Home.js to incorporate the code in HomeController.cs and display "hello world" ? </p>
  
  <p>Apologies if this question appears to have been answered elsewhere - I use a Mac, so the file structure and Visual Studio IDE are quite different and I have struggled to understand quite a few of the tutorials/answers already out there. </p>