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-11-08 08:21:58 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