When I try to fetch data from the UserController I get returned Html for some reason. It is the index.html file under the React > Public folder. It should be returning the Users from the UserController.
I have a React frontend app which I have added ASP.NET Core Web API backend.

============================Update===================================
Follow the tutorial you provide, and do the first 3 steps :
Then I get a solution within 2 projects(one react and one asp.net core 6 web api project)
Adding a controller with your code then I can access the api with url https://localhost:7119/api/user in the browser.
Modify the App.js file in the react project, adding the fetch method in the componentDidMount() function. Then start both the project.
CodePudding user response:
just fix your action route, API controller doesn't support any REST
[Route("~/api/user/getList")]
public ActionResult<IEnumerable<User>> List()
and make the same fetch route
htt.../api/user/getList

