Create a Website Using Laravel and React
In this tutorial, we will show you how to build a complete website using Laravel and React.
Follow the steps below to complete this tutorial:
Create a Laravel Project
The first thing you need to do is create a new laravel project using Composer.
If you do not have Composer installed, please visit How to install Composer .
To create a Laravel project, use composer create-project --prefer-dist laravel/laravel command followed by your project name. Example given below:
composer create-project --prefer-dist laravel/laravel my-website
Laravel with React
Laravel provides a basic starting point using Bootstrap, React/Vue. By default, Laravel uses NPM to install these frontend packages.
Now, navigate to the newly created project folder:
Next, install laravel/ui using Composer:
composer require laravel/ui
Now, to make your Laravel application to use React UI run the following command one by one:
php artisan ui react
Run the Application
From inside your project root folder, run the following command to start your application:
php artisan serve
To view quick changes on your UI, use the following command on a separate terminal:
npm run watch
Now, open http://localhost:8000 on your browser.