This package implements an opinionated set of bindings over React, optimizing for correctness and simplifying basic use cases.
- All React DOM elements and attributes are supported (soon, events are a work in progress).
- An intuitive API for specifying props - simple records, no arrays of key value pairs.
- Attributes are optional, but type-checked. It is a type error to specify hrefas an integer, for example.
- An action/update pattern for local component state, inspired by ReasonReact.
- React lifecycles are available, but not in your way when you don't need them.
- Typeclasses, like Eq props, can be used in component definitions.
You can install this package using Bower:
bower install purescript-react-basicOr clone/fork the starter project.
See the documentation for a detailed overview, or take a look at one of the examples:
React.Basic.Compat is a new (but deprecated) module. It matches most of the old API and types (except setStateThen and isFirstMount) to make upgrading easier and more gradual. You can find ^import\sReact\.Basic\b and replace with import React.Basic.Compat, upgrade the package version, and proceed from there one component at a time (or only new components). See the documentation link above for more info on the new API.