How to use React Router with Laravel?

前端 未结 5 2017
温柔的废话
温柔的废话 2020-12-05 10:01

I needing use React Router with a Laravel project.

But when I create router on the React Router and try access, Laravel<

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-05 10:39

    You can return your index page and browserHistory of React will handle anything else.

    Route::pattern('path', '[a-zA-Z0-9-/]+');
    Route::any( '{path}', function( $page ){   
         return view('index');
    });
    

提交回复
热议问题