4 ms·
In the same vein there's Mithril. It's 8kb but includes a router and a fetch polyfill! I love these little JS frameworks :) https://mithril.js.org/ https://mi
by gandreani 8y ago
In the same vein there's Mithril. It's 8kb but includes a router and a fetch polyfill!
I love these little JS frameworks :)
https://mithril.js.org/ https://mithril.js.org/
- soapdog 8y agoJust want to second Mithril here. It is an awesome and refreshing approach. I love it too.
- starbuzz 8y agoOh, Mithril! All folk desired it. This one is great too.
- dsego 8y agoMithril is nice. One downside is it doesn't lend itself really well to compound components. Everything has to be passed down through attributes.
- davegauer 8y agoTrue, but by passing the same object as an attribute to a pair of Mithril components, I can have them share state. (Can be restricted to the scope of a parent component if desired.) Is there an additional requirement for compound components?
- dsego 8y agoThere isn't a built-in way to detect type of component. It would be useful when you want a parent component to encapsulate certain logic/behavior but not hard-code the presentation. I know there's name() but it only works if my component is a function. Otherwise I think I need to assign some special identifier, which sucks. You can see a great presentation of the technique in this video: https://youtu.be/hEGg-3pIHlE https://youtu.be/hEGg-3pIHlE
- elbear 8y agoYou can define components as simple functions and avoid passing things down through attributes. If you use TypeScript with it, the compiler will always make sure you pass the right arguments to the component, so it's very easy to compose your UI. I also avoid keeping state on components. I know this is controversial and it requires a bit of overheard. However, the simplicity offered by having all state in a single object is worth it for me.