I think it’s better for sharing this way, because it decouples the question of whether the user of the button wants to override the browser’s accessibiltiy design from the button itself.
Can’t believe that such thing exists. I’ve never heard about it
Thank you for your suggestions – I’m happy that I can avoid components in these cases. It’s always better to use plain old functions whenever possible! But I still can imagine a lot of cases where stateful components can’t be avoided:
A password field with “reveal” button I was talking about above.
Widgets like in elm-mdl where even a simple button needs some state for the animation.
Depending on how many such components you have and how often you need to use them in your project, the boilerplate you need to write might or might not be acceptable. And when it’s not acceptable, you’ll need a more powerful solution.
Seems you derived a pretty similar solution to what I did a year ago Anyway there was also quite some flame wars at that time around this.
Anyway, the truth is that discussion is one of the harder ones. I understand the need for this but I have myself experience for working with 50k+ LOC elm single page code base. On the other hand, I even saw some newcomers to our team trying to abuse those patterns to make everything a stateful module (even though actually it’s all just function that manipulates part of a global state). The trouble though is that those things are hard to describe within text short enough one is willing to read within README or discussion. So I guess we’re doomed to argue about certain things over and over despite there is a good intention on both sides.
Anyway more to the actual topic. The experience forced me to remove view part of the type definition. You really want to use views as a regular function and pass some arguments from one view to another. Otherwise, 30% of your app code will be just for synchronization of state shared across components.