I needing use React Router
with a Laravel
project.
But when I create router on the React Router
and try access, Laravel<
Based on Jake Taylor answer (which is correct, by the way) : it has a little mistake, is missing a quotation mark after '/{path?}'
, just the last one.
Also, if you don't need to use a Controller and just redirect back to your view, you can use it like this:
Route::get( '/{path?}', function(){
return view( 'view' );
} )->where('path', '.*');
Note: Just make sure to add this Route at the end of all of your routes in the routes file ( web.php for Laravel 5.4 ), so every existing valid route you have may be catched before reaching this last one.