abdulrehman176617's avatar

which one to choose ?

If I use Laravel, do I have to use a JavaScript framework for a single-page application? Should I choose Vue.js? Why shouldn't I choose React.js, which is more popular? If I use Next.js, than I do not need Laravel, since Next.js is full-stack?

0 likes
4 replies
MohamedTammam's avatar

do I have to use a JavaScript framework for a single-page application?

No

Should I choose Vue.js?

Can you choose whatever you want, Vue is more popular among Laravel community for historical reasons (In short it was coming already was Laravel in older version and first party packages are built with it).

Why shouldn't I choose React.js, which is more popular?

React is more popular in general. And you can choose what you want or none.

If I use Next.js, than I do not need Laravel, since Next.js is full-stack?

If it does what you want, yes. Otherwise you need a back-end and I suggest Laravel.

3 likes
lpheller's avatar

Even though next.js is considered full-stack in the world of JavaScript frameworks, it is a completely different story to Laravel.

Of course you can use next.js framework for an SPA powered by Laravel. For a simple example, see https://github.com/laravel/breeze-next

However, the actual question of whether a JavaScript framework is needed when using Laravel is simple "no". Laravel has a good templating engine of its own - Blade - which, in combination with a bit of Javascript using e.g. Alpine.js, can power many Laravel applications and be completely sufficient.

And if you like Blade and don't want to use a Javascript framework, but need a little more "SPA feeling" and reactivity, then something like Livewire (https://livewire.laravel.com/) or Splade (https://splade.dev/), takes the game to a new level.

2 likes
martinbean's avatar

@abdulrehman176617 You don‘t have to use JavaScript and build a SPA if you don’t want to. It’s completely fine to build an application with controllers and Blade views.

gych's avatar

Personally I prefer to use Vue + Inertia when creating an SPA with Laravel but like others have already mentioned you don't need to use a javascript framework to create an SPA with laravel there are other options like Livewire.

Please or to participate in this conversation.