I've seen this not-so-perfect solution where we're supposed to place a universal view route and then route everything from react-router like so:
Route::view('/{any}', 'layouts.app')->where('any', '.*');
or
Route::view('/{any?}', 'layouts.app');
But the big issue here is when I'm fetching data to react from within my laravel application, for example: /posts, react-router will try to resolve /posts, but laravel will match it with /{any?}, and the fetch call will respond with a view.
Is there a way to make apiResource calls like described, and if so, how?