React with Adonis

I am trying to integrate React with Adonis Js to create a SPA. Adonis handles routing to SPA on

Route.any('*', function * (request, response) { yield response.sendView('home') }) 

I did just that in app> Http> routes.js

Then I created home.njk in Resources> Views to act as the landing page for my application. Now I have a reaction file where I created a footer. I want to handle all the links in the footer using React-router. React router processes URLs to go to the page. However, the above code (in Adonis) says that any url (*) is going to display "home". This is exactly what is happening.

How to get around this? Thanks!

+5
source share
1 answer

You must define api routes to route * .

Adonis Router will routes.js your routes.js file and get the first matching route.

+4
source

Source: https://habr.com/ru/post/1259816/


All Articles