There was a problem with creating a route. Links that go to the first level work, and the second is gone. For example, public / admin - everything works, but public / admin / rooms - no longer works. The backend is made on Laravel.

Route::get( '/{path?}', function(){ return view( 'welcome' ); } )->where('path', '.*'); 

This is in the web.php

On the main page I already want to change the components and issue everything that is necessary by the links:

  ReactDOM.render( <Router> <Switch> <Route path="/public" exact component={App} /> <Route path="/public/rooms" component={RoomMain} /> <Route path="/public/admin" exact component={Admin} /> <Route path="/public/admin/rooms/create" component={CreateRooms} /> <Route render={() => (<div>Sorry</div>)}/> </Switch> </Router>, document.getElementById('root') ); 

This construction does not work, <Route path="/public/admin/rooms/create" component={CreateRooms} />

What could be the problem. There used to be just a 404 error, and now: Uncaught SyntaxError: Unexpected token <

  • I hope you have no routing on the PHP side. If you are working with SPA, the server configuration should redirect all requests to index.html - Alexandr Tovmach

0