rockerest’s avatarrockerest’s Twitter Archive—№ 19,236

    1. …in reply to @kmelve
      kmelve Exactly. Some people prefer top-down (e.g. Redux) style prop passing, but I prefer an event mediator pattern backed up by localized state machines (so your view components can't get into broken states).
  1. …in reply to @rockerest
    kmelve I don't know what the state of the art is for global variables (a la Redux) in web components, because I've found the event mediator pattern to be perfectly fine at any project I've thrown at it. I suspect - however - that WC are generic enough that you can pick any data flow
    1. …in reply to @rockerest
      kmelve you want, and WC will slot in at the lowest / penultimate lowest layer without too much complaint.
      1. …in reply to @rockerest
        kmelve If you start moving WC to higher and higher levels (like whole page views), you're going to really be wanting something like Lit (I also hear Stencil is good). I do this, by the way, and it's painless, once I'm using a small (5-12kb) library like Lit.
        1. …in reply to @rockerest
          kmelve To be clear you can do any of this stuff (like reactive data binding, etc.) without any libraries but unless this is purely a learning exercise I don't suggest it. If it IS a learning exercise, I do strongly suggest it, so you can appreciate what's being brought to the table 😂