PHPnews.io

Reusable Alpine Components by Ryan Chandler

Written by Sebastian De Deyne / Original link on Apr. 7, 2021

I’ve been more Alpine lately. Ryan has written a lot of good stuff on Alpine, but his reusable components post is what really got me kickstarted.

You should be careful to not abstract too early. If you are finding it difficult to manage your Alpine component from the x-data attribute, this one is definitely for you.

The way this article builds up was very helpful: only use the level of abstraction you need:

  1. No abstractions
  2. Extract to a component function
  3. Use x-spread
  4. Mix in other data

sebastiandedeyne

« Voting Database Structure - Event sourcing projectors in depth »