react-haskell: Haskell React bindings

[ library, mit, web ] [ Propose Tags ]

This package provides high level bindings to Facebook's React library, meant for use with GHCJS.

React is a JavaScript library for building user interfaces. React (and React-Haskell) is focused on just UI - it's not a framework.

Currently React-Haskell can render simple stateful components, but not what React calls classes. Put another way, React-Haskell doesn't support lifecycle methods yet.

Here's a simple example which demonstrates basic elements, attributes, state, and handling events.

-- We're creating a class with JSString state
data Example
instance ReactKey Example where
    type ClassState Example = JSString
    type AnimationState Example = ()
    type Signal Example = JSString

-- updating to the new state without animation
transition :: JSString -> JSString -> (JSString, [AnimConfig Example])
transition oldState signal = (signal, [])

view :: JSString -> React Example ()
view str = div_ [ class_ "container" ] $ do
    input_ [ value_ str, onChange (Just . value . target) ]

main :: IO ()
main = withElem "id" $ \elem ->
    render elem =<< createClass view transition "" () []

Flags

Automatic Flags
NameDescriptionDefault
ghcjs

tell cabal we're using ghcjs

Enabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 1.1.0.0, 1.2.0.0, 1.3.0.0, 2.0.0, 2.0.1
Dependencies aeson, base (>=4.5 && <5), deepseq, ghcjs-base (>=0.1), ghcjs-dom (>=0.1), ghcjs-prim (>=0.1.0.0), lens-family, monads-tf, text, transformers, unordered-containers, void (==0.7) [details]
License MIT
Author Joel Burget
Maintainer joelburget@gmail.com
Category Web
Home page https://github.com/joelburget/react-haskell
Bug tracker https://github.com/joelburget/react-haskell/issues
Source repo head: git clone https://github.com/joelburget/react-haskell.git
Uploaded by joelb at 2015-07-21T15:42:59Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 3399 total (15 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2015-07-21 [all 1 reports]