[Vuejs]-What is the alternative of the code below in react from vue js

0👍

This was the problem

and the reason is so simple below in the Controller dir, I used App\Models\User

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Models\User;

class FollowsController extends Controller
{

public function store(App\Models\User $user)
{
    return $user->username;
}

}

instead of User after declaring the use method.

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Models\User;

class FollowsController extends Controller
{

public function store(User $user)
{
    return $user->username;
}

}

0👍

And to get data from laravel blade.php we can simply use

                <script>
                let userId = '{{ $user->id }}';
                </script>

Now we can use the ‘userId’ variable to our react component.

ThankQ!

Leave a comment