#Add programmatically blade components through JS.

7 messages · Page 1 of 1 (latest)

solid rampart
#

Hey there!
I'm retrieving a list of results through JS fetch, and my intention is add each line programmatically in my HTML using blade component, i search about it, and i found that isn't possible because the component is rendered in backend. Can u help me? There are some way to do this?

crisp tapir
#

i search about it, and i found that isn't possible because the component is rendered in backend

You have your answer here.

You can use Livewire or something to do reactivity, or use a "real" frontend framework

north flare
#

you could create a endpoint that renders just the needed component then append the html using javascript

#

but seems like a weird way to go about it

crisp tapir
#

Well true, it's technically possible by some magic. But in the sense of simply updating the DOM w/ a Blade component, that's not going to work very well

#

It'll be better to just use Livewire at that point if you want the Blade syntax

solid rampart
#

@north flare That's a weird way, i preffer to keep the good practices, thanks anyway, all solutions is a solution. heheh.