glazier-react-0.3.0.2: ReactJS binding using Glazier and Pipes.Fluid

Safe HaskellNone
LanguageHaskell2010

Glazier.React.Element

Description

HtmlT inspired monad for creating ReactElements

Synopsis

Documentation

unsafeCoerceElement :: JSVal -> ReactElement Source #

Unfortunately, ReactJS did not export an easy way to check if something is a ReactElement, although they do so in the internal code with REACT_ELEMENT_TYPE. This function allow coercing a ReactElement from a JSVal and is marked unsafe as a reminder that the coersion is unchecked. This function is required when receiving ReactElement from javascript (eg in a callback) or to interface with foreign React Elements.

mkBranchElement :: JSVal -> [Property] -> [ReactElement] -> IO ReactElement Source #

Create a react element (with children) from a HashMap of properties

mkLeafElement :: JSVal -> [Property] -> IO ReactElement Source #

Create a react element (with no children) from a HashMap of properties

textElement :: JSString -> ReactElement Source #

Not an IO action because JSString is immutable

mkCombinedElements :: [ReactElement] -> IO ReactElement Source #

React only allows a single top most element. Provide a handly function to wrap a list of ReactElements inside a div if required. If there is only one element in the list, then nothing is changed.