DON'T Just Watch Tutorials, Google, AI... TAKE ACTION

Video thumbnail

I wanted to automate a couple of listings, but here comes the complexity. Using Livewire behind the scenes, I was annoyed by figuring out how to fill out all the fields. The problem is, when you change one of the listings, the other has to make the changes.

So, I couldn't remember how to do this and asked ChatGPT.

I specifically asked for help disabling fields because I have two different properties, and clicking on one would disable the other. I needed to apply a class, but I'd forgotten how to do it.

The code ChatGPT suggested had a problem: it only worked on the client side and didn't indicate how to handle it on the server. The solution required wire:model.live, which it didn't include:

<div class="flex flex-col border rounded p-3 ml-3 bg-purple-200">
    @foreach($book->sections()->where('posted', 'yes')->where('orden', '>', 0)->orderBy('orden')->get() as $key => $s)
        <div class="mb-3">
            <label class="block font-semibold mb-1">
                <input
                    type="checkbox"
                    wire:model="previewCaps.{{ $key }}"
                    class="ml-2"
                />
                {{ $s->title }}
            </label>

            <input
                type="number"
                class="border rounded px-3 py-1 w-full"
                wire:model="previewPercent.{{ $key }}"
                min="0"
                max="100"
                @disabled(!($previewCaps[$key] ?? false))
            >
        </div>
    @endforeach
</div>

That's key, because without .live, Livewire doesn't sync the status in real time. And that brought me to the main point of this article:

wire:model="previewCaps.live.{{ $key }}"

The real problem: lack of experience
It's not the AI's fault. Rather, it was my fault for not giving it enough context. And that's something I want to make clear to you:

If you don't know what you're doing, AI isn't going to save you.

ChatGPT can give you 97% of the solution, but that missing 3% may be the most important, and you need experience to identify it.

Taking Action: Beyond Tutorials
I'm linking this to another article I wrote: "Avoid Tutorials and Google." I also received a comment that, honestly, didn't understand the message.

It's not about not watching tutorials, not using Google, or not using AI. The message is: take action!

It's fine to consult resources, but the important thing is that you create your own solutions and gain experience.

Again, the problem isn't using AI, tutorials, or Google. The problem is that if you don't take action and don't have experience, you won't know how to interpret the answers you get.

I agree to receive announcements of interest about this Blog.

The most important thing when using AI is context and having the experience to be able to successfully leverage it.

- Andrés Cruz

En español