morningtrain/laravel-react

A context helper package for Laravel

2.3.0 2023-05-08 05:10 UTC

This package is auto-updated.

Last update: 2024-10-08 08:07:57 UTC


README

React for Laravel

Install

Via Composer

$ composer require morningtrain/laravel-react

Usage

View

In your controller:

return view('your_view')->with([
    'component' => 'Welcome',
    'props'     => [
        'title' => 'From controller',
    ],
    'options'   => [],
]);

And in your view:

@react()

Or straight from view:

@react([
    'component' => 'Welcome',
    'props' => [
        'title' => 'From view',
    ],
    'options' => [],
])

Credits