Today, We are going to learn how to Install ReactJS in latest Laravel 9. This tutorial will cover the step on installing the ReactJS into laravel 9. So, Before installing ReactJs we will see what is ReactJS?
What is ReactJS?
Advantages of ReactJS:
- Extremely competent.
- Excellent cross-platform support.
- Handles dependencies.
- Template designing made easy.
- Provides amazing developer tools.
- UI focused designs.
- Easy to adopt.
Also Read : Laravel 9 Sorting Columns with Pagination
Install ReactJs in Laravel 9:
- Step 1 : Install Fresh Laravel Application
- Step 2 : Install Laravel UI
- Step 3 : Install ReactJS
- Step 4 : Install React with Auth
- Step 5 : Install Required Packages
- Step 6 : Conclusion
Install Fresh Laravel Application
First, We are going to install a fresh new Laravel project.
To install a Laravel project open a Terminal and run the following command:
composer create-project laravel/laravel reactjs-project
reactjs-project is the Laravel project name.
Install Laravel UI
We are installing a Laravel UI to start with Laravel 9.
Run the following command to install Laravel UI.
composer require laravel/ui
The above command will install the Laravel UI package.
Also Read : How to Create a Login Form in PHP Example
Now, Its time to install React to your Laravel project.
To install the React into your application run the following command in the terminal:
php artisan ui react
Install React with Auth
or if you like to create React with Authentication run the following command in the terminal:
php artisan ui react --auth
This will create a Laravel 9 React Application with authentication.
Install Required Packages
We will installed other required packages to our Laravel 9 React Application.
Please first install NODE in your system. So, we will assume that you had installed a node in your development machine.
Also Read : How to Login with Google in PHP
Check the Node and NPM Version running following command:
# Node Version node -v # NPM Version npm -v
npm run dev
Run Laravel Application:
php artisan serve
Congratulations! You have successfully installed ReactJS in Laravel 9 Application.
Hope this tutorial helped you in installing ReactJs into Laravel 9 Application and Thanks for reading! If you have any question so, please ask us by commenting below. Thank you!
5 thoughts on “Install ReactJS in Laravel 9 Tutorial”