Skip to content
Advertisement

Nested Folder Dynamic Component – Laravel Blade

Trying to use a dynamic component in order to pass in a variable and get to the component file I need. However, the component files are nested in another folder inside the components folder. I’m unable to do the normal <x-foldername.file /> since it is a dynamic component.

Is there a different way to go into a subfolder using dynamic components? Below is an example of the component call I’m currently doing that won’t work with the file in the subfolder.

<x-dynamic-component :component="$component_variable" :data="$data" />

Advertisement

Answer

Ok I figured it out.

<x-dynamic-component :component="'foldername.' . $component_variable" :data="$data"/>
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement