Answer the question
In order to leave comments, you need to log in
How to solve Laravel + React routing issues?
Good evening!
Help solve the problem, please.
App.js Code
class App extends Component {
render () {
return (
<BrowserRouter>
<div>
<Header />
<Switch>
<Route exact path="/" component={Homepage}/>
<Route exact path="/cars" component={Cars}/>
<Route path="/cars/:id" component={Car}/>
<Route path="*" component={NotFound}/>
</Switch>
</div>
</BrowserRouter>
)
}
}
Route::view('/{path?}', 'app');
Route::get('/', '[email protected]');
Route::get('/cars', '[email protected]');
Route::get('/cars/{car}', '[email protected]');
Answer the question
In order to leave comments, you need to log in
Fucking pussy! I found a solution!
// web.php
Route::get('/{view?}', function () {
return view('app');
})->where('view', '(.*)');
If the link https://mywebchik.xuyax/cars/1 after https://mywebchik.xuyax/cars works, but it doesn’t work without it, then this is not rotting, and something is wrong with your backend business logic. I suppose you pre-record something in the session?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question