laravel / ideas

Issues board used for Laravel internals discussions.
938 stars 28 forks source link

Progressive Integration for React Components #768

Closed aleemb closed 7 years ago

aleemb commented 7 years ago

Description:

The great thing about Vue is that it you can integrate it progressively, unlike React which is all or nothing.

It would be great to allow converting just a single page of the Laravel app over to React while keeping the rest the same. Or integrate a React component into an existing page without moving toward SPA or converting that entire page into a JS component just to be able to include a single React component.

This requires some plumbing but is achievable and can up the ante for React developers.

Maybe a blade directive @react('MyComponent', [$arg1, $arg2, ...]) which would generate the proper HTML with data-* tags into which React would render the component. The react and react-dom libs would need to be loaded separately as external dependencies so they aren't bundled with each component.

sisve commented 7 years ago

Not everyone uses react. Why should this be part of the framework, and not a separate package?

Dylan-DPC-zz commented 7 years ago

do check #525

aleemb commented 7 years ago

@sisve I suppose the same as the reason for VueJS (though I understand VueJS is partnered with Laravel which makes it easier). However, React has a much larger community and so it would benefit both Laravel and React ecosystems as a whole.

React support is already there, this would extend the presets to improve the UX/DX to modular development as opposed to the current, all or nothing.

sisve commented 7 years ago

One important thing to keep in mind is the licensing. We must make sure that any implementation provided does not enforce the react patents license upon Laravel users.

themsaid commented 7 years ago

Thank you for your suggestion, but looks like not enough members are interested in such change so I'm going to close this issue.