https://github.com/ecliptic/purescript-recompose
PureScript bindings for acdlite/recompose using purescript-react
https://github.com/ecliptic/purescript-recompose
javascript purescript react recompose
Last synced: 11 days ago
JSON representation
PureScript bindings for acdlite/recompose using purescript-react
- Host: GitHub
- URL: https://github.com/ecliptic/purescript-recompose
- Owner: ecliptic
- License: mit
- Created: 2016-08-05T21:32:35.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-07T18:27:50.000Z (about 8 years ago)
- Last Synced: 2025-04-06T15:56:41.769Z (15 days ago)
- Topics: javascript, purescript, react, recompose
- Language: PureScript
- Size: 56.6 KB
- Stars: 11
- Watchers: 1
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# purescript-recompose
[](https://github.com/ecliptic/purescript-recompose/releases)
[](https://github.com/ecliptic/purescript-recompose/releases)
[](https://discord.gg/2PCKqHc)
[](https://travis-ci.org/ecliptic/purescript-recompose)A PureScript interface to [recompose](https://github.com/acdlite/recompose), a “React utility belt for functional components and higher-order components”. Recompose provides a great way to access React’s features in a more functional way, and it defines many useful higher-order components for easy composition.
* [`purescript-recompose` API documentation](https://github.com/ecliptic/purescript-recompose/blob/master/docs/React/Recompose.md)
* [Original `recompose` API documentation](https://github.com/acdlite/recompose/blob/master/docs/API.md)
* [Example TodoMVC implementation](https://github.com/ecliptic/purescript-recompose-todomvc)## Usage
Install with bower:
$ bower install --save purescript-recompose
Compose with your existing components:
```purescript
newTodo :: ReactClass Unit
newTodo = withHandlers handlers $ myComponent
where handlers = { addTodo }type HandleAdd props eff =
{ add :: String -> Eff eff Unit | props } ->
{ target :: { value :: String } } ->
Eff eff UnitaddTodo :: forall props eff. HandleAdd props eff
addTodo props event = props.add event.target.value
```In this example, `myComponent` is an existing React component. `newTodo` is the resulting component after wrapping it with recompose’s `withHandlers` higher-order component.
## License
MIT