MHN

Show HN: Affinity.js – A simple view component library with store

33 points by orizens·2945 days ago·Show in HN

with affinity you can make multiple apps (components eventually) and store (ala redux) - while a store can be shared through apps.

This started as a case study and as a small reusable code for creating self contained dom elements with functionality - during the time of development, ideas and inspiration came from angular, react and vuejs.

suggestions and feedback is mostly welcomed.

The interesting challenges were finding ways for these topics:

  1. create a component lib using dom and js only, without any 3rd party .
  2. producing semantic html in dom .
  3. allow template micro syntax (using @click to bind an event listener) .
  4. allow reusing custom elements within a component's template .
  5. creating a simple store interface and auto connect it with

a component to allow re render whenever the store changes .

any feedback and suggestions are welcomed

https://github.com/orizens/affinity

Add a comment on Hacker News →
1 of 12 comments
  1. Have you explored the mithril.js [1] project? It seems to have reasonably similar goals, although the templating is pretty different from how you implemented it. Mithril doesn't have a concept of state, which also sets it apart from your project, but it seems to handle re-rendering just fine without it.

    [1] https://mithril.js.org/