3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Laravel7.xでフロントをReactに切り替える方法

3
Last updated at Posted at 2020-03-13

概要

バックエンドにLaravel、フロントにReactを使ったWebアプリケーションを作りたい場合の簡単な切り替え方法。
Laravel7.xから若干手順が変わっていたので備忘録として残しておく。

手順

// Laravel7.x以降
$ composer require laravel/ui
$ php artisan ui react

// Package.jsonにReact関連の依存関係が追加されているのでインストールする
$ npm install

// コンパイルできるか確認
$ npm run dev

Laravel5.5から導入されたphp artisan preset reactですが、Laravel7からphp artisan ui reactに変更になっているようです。

参考にさせて頂いた記事

[JavaScript & CSS Scaffolding - Laravel - The PHP Framework For Web Artisans]
(https://laravel.com/docs/7.x/frontend#introduction)
[reactjs - Laravel 5.4 can't run "php artisan preset react" comand - Stack Overflow]
(https://stackoverflow.com/questions/48381322/laravel-5-4-cant-run-php-artisan-preset-react-comand)
[Laravel Frontend Presets - Taylor Otwell - Medium]
(https://medium.com/@taylorotwell/laravel-frontend-presets-eca312958def)

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?