Is it permissible to provide a null prop? I have created a main component that accepts the user
prop.
<div id="app">
<master :user="{{ $user }}"></master>
</div>
The prop is declared as follows:
props : {
user: {
type: Object
}
},
Within the controller, I am passing the user variable only if the user is authenticated, otherwise I am passing null:
public function index()
{
$user = Auth::check() ? Auth::user() : null;
return view('master', compact('user'));
}
I am encountering an error message stating
The value for a v-bind expression cannot be empty
. I have attempted to resolve this issue by removing the colon to avoid binding and also explicitly specifying that the prop is not mandatory, but neither of those solutions has worked.
Is there a way to address this problem so that I can pass a null or empty object to Vue?