title: Why do I get JSON.parse error when using default code from "dotnet new react -o my-app"?
body: <p>Running the terminal command 'dotnet new react -o my-app' builds a C# React app, but when testing the starting files it doesn't work.  Running 'npm start' from the my-app/ClientApp directory starts the app but navigating to the page <a href="http://localhost:3000/fetch-data" rel="nofollow noreferrer">http://localhost:3000/fetch-data</a> you get the console error:</p>
  
  <blockquote>
    <p>"SyntaxError: JSON.parse: unexpected character at line 1 column 1 of
    the JSON data"</p>
  </blockquote>
  
  <p>This is the block of code that it never gets past:</p>
  
  <pre><code>constructor(props) {
  super(props);
  this.state = { forecasts: [], loading: true };
  
  fetch('api/SampleData/WeatherForecasts')
    .then(response =&gt; response.json())
    .then(data =&gt; {
      this.setState({ forecasts: data, loading: false });
    });
  }
  </code></pre>
  
  <p>It calls this controller, but the code in it never runs:</p>
  
  <pre><code>[Route("api/[controller]")]
  public class SampleDataController : Controller
  {
      [HttpGet("[action]")]
      public IEnumerable&lt;WeatherForecast&gt; WeatherForecasts()
      {
          Console.WriteLine("I NEVER GET CALLED");
          var rng = new Random();
          return Enumerable.Range(1, 5).Select(index =&gt; new WeatherForecast
          {
              DateFormatted = DateTime.Now.AddDays(index).ToString("d"),
              TemperatureC = rng.Next(-20, 55),
              Summary = Summaries[rng.Next(Summaries.Length)]
          });
      }
  </code></pre>
  
  <p>I'm using these docs to build the app:</p>
  
  <p><a href="https://docs.microsoft.com/en-us/aspnet/core/client-side/spa/react?view=aspnetcore-3.0&amp;tabs=netcore-cli" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/aspnet/core/client-side/spa/react?view=aspnetcore-3.0&amp;tabs=netcore-cli</a></p>
  
  <p>I plan to use this as a scaffold to build a new app, but I'm concerned that it isn't working before I've done any coding to it.  Does anyone know why or how to fix it?</p>