Skip to content

sam-blake/purescript-react

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

purescript-react

React Bindings for PureScript.

WARNING: This is alpha quaility software and you need to use nightly build of React.

module Main where

import React
import React.DOM

hello = mkUI spec do
  props <- getProps
  return $ h1 [
      className "Hello"
    ] [
      text "Hello, ",
      text props.name
    ]

incrementCounter = do
  val <- readState
  writeState (val + 1)

counter = mkUI spec { getInitialState = return 0 } do
  val <- readState
  return $ p [
      className "Counter",
      onClick incrementCounter
    ] [
      text (show val),
      text " Click me to increment!"
    ]

main = do
  let component = div {} [hello {name: "World"}, counter {}]
  renderToBody component

About

React Bindings for PureScript

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PureScript 88.0%
  • JavaScript 5.2%
  • Python 4.0%
  • Makefile 2.8%