What seems to be the problem:
Child component not rendering new data from parent. Only renders on mount.
I have a form wizard that when I hit submit, a new set of fields is displayed.
In a child component I wish to display the data that has been previously submitted.
Please see pseudo code:
// parent.php
class Parent extends Component
{
public $data;
public function mount ()
{
$this->data = model->get_data();
}
public function submit ()
{
// gets the new data after submit
$this->data = model->get_data();
}
public function render ()
{
return view('livewire.parent');
}
// parent.blade
@livewire('child', ['data' => $data]);
// child.php
class Child extends Component
{
public $data;
public function mount($data)
{
$this->data = $data;
}
public function render()
{
return view('livewire.child');
}
// child.blade
@foreach ($this->data as $data)
{{$data}}<br>
@endforeach