If CSS transitions are too limited (they often are :( ), Gage Peterson is 
right about having to put that "state" in your model, there really isn't 
any alternative in Elm (apart from delegating to some JS code to do it 
instead but that lowers the maintenance fun)

Just wanted to correct one thing: Component local state is not considered a 
bad practice in React, at all. Lifting state such as "whether a select 
dropdown is opened", "the component has focus", "which grid row is 
currently highlighted" or in general any state that should reset should a 
component be unmounted/remounted to the global state atom is a bad move. 
That leaves the responsibility of determining by experience whether a piece 
of data is state or props, and people make so many mistakes doing that. 
Thankfully, The Elm language make the single atom approach much less 
painful than in JS thanks to pattern matching and terse Record updates.



On Friday, May 27, 2016 at 7:15:27 PM UTC+2, Gage Peterson wrote:
>
> This may not be a satisfactory answer but you could just do it with CSS 
> animations. Doing it in elm requires that the state reside somewhere in the 
> model. There's no "state" part like in React (now considered mostly a bad 
> practice even in that community). 
>
> On Friday, May 27, 2016 at 4:46:06 AM UTC-6, John Watson wrote:
>>
>> If I have a bunch of buttons that all need to respond to mouseOver 
>> 'hover' in the same way, what's the best practice for implementing this in 
>> elm?  I have so far looked at mdgriffith/elm-style-animation.  This seems 
>> fine although I wondered if using this for such simple behaviour was 
>> overkill.  As far as I can see I need to keep track of state for each 
>> button and allocate an id to each.
>>
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to