How to Install Laravel 8 Project with React Js

How to Install Laravel 8 Project with React Js

How to Install Laravel 8 Project with React Js



  • Create a fresh Laravel Project:

composer create-project --prefer-dist laravel/laravel projectname

composer require laravel/ui


  • Generate Basic Scaffolding:

php artisan ui react //for react connect with laravel


  • Build All

npm install

npm run dev


  • If you need an authentication system on your website then run this command. otherwise, ignore

php artisan ui react --auth


  • React Router 6

npm add history react-router-dom@next

yarn add history react-router-dom@next


  • Working with react state, then you need to add those instruction in package.json

"babel":{

   "presets":[

  "@babel/preset-env",

  "@babel/preset-react"   

],

"plugins":[

"@babel/plugin-proposal-class-properties"

]

}


  • Controller Create

php artisan make:controller ControllerName

  • Create Model

php artisan make:model modelName

  • Migrate Table

php artisan migrate

  • If needed to change any Attribute then you can re-migrate the table using this command:

php artisan migarte:rollback