JSON Error When Creating a React App with the .NET Core CLI

I recently encountered a bug while spinning up a new .NET Core React app so I figured I would share my solution to the problem.

This issue occurs when navigating to the Fetch Data controller after creating a new .NET Core React app using cli command dotnet new react.

  

  

Even though the network response returned with a 200 OK response, the data failed to return in the view.

  

  

To remove this error simply add “proxy”: “https:localhost:5001” to your package.json.

  

  

Press Ctrl + C to stop and restart your application using dotnet run and navigate to the Fetch Data. You should now see your data in the view and without error in the console!

  

Leave a Reply

Your email address will not be published. Required fields are marked *