The react-haskell package


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

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 . targetValue) ]

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


Versions1.1.0.0,,,, 2.0.0, 2.0.1
Dependenciesbase (>=4.5 && <5), deepseq, haste-compiler, haste-lib (>=0.4 && <0.6), lens-family, monads-tf, transformers, void (==0.7) [details]
AuthorJoel Burget
Home page
Bug tracker
Source repositoryhead: git clone
UploadedSun Jan 4 20:05:29 UTC 2015 by joelb




haste-instBuilt with haste-inst/hastecDisabledAutomatic

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


Maintainers' corner

For package maintainers and hackage trustees