liqula / react-hs

A GHCJS binding to React based on the Flux design. The flux design pushes state and complicated logic out of the view, allowing the rendering functions and event handlers to be pure Haskell functions.
32 stars 10 forks source link

Consider a blaze-html style approach to DOM attributes #66

Open tysonzero opened 7 years ago

tysonzero commented 7 years ago

The blaze-html approach with using the ! operator to modify / add attributes has several benefits. One is that you get to avoid needing the whole empty list thing for when you don't want to specify any attributes, while still keeping the type nice and simple. It's also easy to make it so that you can apply the attributes both before and after defining the contents, so both, div_ ! bar "bar" $ "foo" anddiv "foo" ! bar "bar"` will work.

Currently the types for DOM elements are pretty gnarly, I think part of that is to handle stateful vs non stateful views, but that can be avoided by looking further into the whole flux decoupling thing, as now there will just be one type of view, and actions can either modify local state references or send off global store actions, or both.