Answer the question
In order to leave comments, you need to log in
How to make React work with its own routing on a separate page of an ASP.NET application?
There is an ASP.NET.MVC application (probably I'm a front-ender - I don't really understand it). There are several pages from the Razor template engine. On one of them I want to tie a SPA on react with internal routing. That is, the server returns the site.com/admin page, and the react is already running on it, in which I configured the router. But the problem is that when you go, for example, to /admin/accounts (available in the router), the server returns 404, because it does not know such a page. I believe that you need to somehow configure it so that for any link that starts with /admin, the server gives the react page and then it understands itself. At the same time, it is important that the rest of the "template" pages do not break and the api too. Found a variant with route supposedly for SPA "routes.MapSpaFallbackRoute("spa-fallback", new { controller = "Home", action = "Index" });" but this did not help, as far as I understood, partly because my page is not indexed and there is no controller for it. Please help me to adapt this correctly for my case. Or maybe there are other options?
Answer the question
In order to leave comments, you need to log in
See how it works in the template https://docs.microsoft.com/en-us/aspnet/core/clien...
...react works on it, in which I configured the router...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question