'Laravel Livewire: How to transfer Data from one route to other in livewire?

I have to routes two to views home and cart (regular blade views not livewire)

  1. ...app/vendorId/home 2)...app/vendorId/cart

  2. '/home' route has a blade view with a two livewire components the code is shown below a) vehicle b) products

@extends('layouts.app')

@section('content')
    @livewire('vehicle-list')
    @livewire('products', ['vendorId'=>$vendorId])
@endsection

  1. '/cart' will have one livewire component
@extends('layouts.app')

@section('content')
    @livewire('cart', ['vendorId'=>$vendorId])
@endsection

Now I want to get the data selected by the user from home page to the cart page. How can I do that? I have tried events but it did not work.

I am stuck at this for a while an help would be appreciated. Thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source