Dynamic components in Laravel often needs to share data throughout the site. A common example is a navbar that dynamically loads the most recently added categories.
View composers are one way to tackle this problem.
Let’s take the navbar component, which takes a prop:
@props(['categories'])