What's the view path of a multi-file component in Livewire 4?

3 days ago 9
ARTICLE AD BOX

You forgot to include the emoji (⚡) from the folder name in the view path!

That's easily overlooked since the docs don't show an example of specifying a view with an emoji in the path (although it should get very common now in Livewire 4).

The examples below all work for you:

return view('pages.users.⚡index.index', [ 'users' => $this->users(), ]); return view('pages::users.⚡index.index', [ 'users' => $this->users(), ]);

This syntax has been added newly in the 4.x docs as example for "Passing data from render()"

return $this->view([ 'users' => $this->users(), ]);

This is my favorite, since it avoids explicitly specifying the view path altogether. Convention over configuration - nice!

lchristmann's user avatar

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.

Read Entire Article