1

I'm start react learning, I've a question. Can I use react in Laravel ? Is it possible to work with react instead of jQuery?

Should I use API for using laravel in react?

Can react be the perfect replacement for jQuery? or Can designing very beautiful sites?

4 Answers 4

2

You can just use this command with Laravel to scaffold frontend.

php artisan preset react

put all your react.js component files in resources/assets/ folder and give rest of this things to work by laravel.

To get deep dive into this here are some useful links:

https://laravel.com/docs/5.7/frontend

https://blog.pusher.com/react-laravel-application/

Sign up to request clarification or add additional context in comments.

Comments

1

You can use React.js with Laravel. In Laravel you would create API and then you can send calls from React.js and get JSON data from API-s.

I have created Boilerplate project where React is integrated with Laravel. Follow instructions and enjoy.

Question is old but I hope it will help someone in future!

https://github.com/aldinkole/Laravel-v8.52-and-React-v17.0.2-Boilerplate

Comments

0

Instead React is a front library you can use it a Replacement of jQuery thats how i learned React JS.

Eg:

Option 1 : use Laravel Authentication and blade views and Inside Blade views try to implement React for CRUD operation or form submit. Use CDN react links to get the dependencies. (Easy way of implementing a react functionality)

Option 2 : you can create a whole react application using create-react-app : https://github.com/facebook/create-react-app#creating-an-app

But for both options we need a Laravel REST API's to Manipulate the data's

3 Comments

I'm facing the same questions Like arman -> So it's not a bad practice to use React JS just for a few pages where I need CRUD operations or forms - and Pages with just data presentation I can go just with Laravel blade views?
@Mike_NotGuilty in your case if you already have the API's for those data presentation then you can go with React JS. If you don't have the API's i will suggest you to go with laravel Blade. or else if you care about user Interaction create API's and build with React JS.
I'm starting from the scratch. I want also to create an app. So for some parts I need an API for sure. My question is - does it make sense to create an API for everything - or just for the parts that are also included in the app. So parts where I have an API -> ReactJS; Everything else -> Blade views.
0

You can access your all of question by and article in two parts:

  1. Part-1
  2. Part-2

But If I wanna write an app, I use REST architecture for it, write backend by laravel and write frontend by react and then publish both in a separate stack. react app just call APIs that laravel gave to it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.