Share this:
FacebookTwitterRedditPinterestTumblrTelegramSkypeMessengerWhatsAppShare

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?

React is a free and open-source front-end JavaScript library for building user interfaces based on UI components. It is maintained by Meta and a community of individual developers and companies.

Advantages of ReactJS:

  • Makes JavaScript coding easier.
  • 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 application with reactjs

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

Install ReactJS

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

Install NPM:

npm install

Run NPM:

npm run dev

Run Laravel Application:

php artisan serve

Conclusion

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!

Also Read : PHP Chunk File Upload using JavaScript

Share this:
FacebookTwitterRedditPinterestTumblrTelegramSkypeMessengerWhatsAppShare

Categorized in: