Renderless components are one approach for code reuse among Halogen components. By abstracting out the render function altogether, you can implement the component's behaviors and state without making any rendering decisions as a library author. As a library user, you can implement your rendering however you see fit and you can selectively attach the behaviors that have been made available to you.
This repository contains two things:
- the minimal implementation for a renderless component you can use as a template for your own components in
/example
- a library of helper functions for working with the
Store
comonad for your component state in/src
.
The component implemented in this project is a working renderless component. Either take it and use it as a scaffold for a new component you're building and would like to share, or use it to update an existing component to be renderless.
# psc-package
psc-package install halogen-renderless
# bower
bower install purescript-halogen-renderless
Module documentation is published on Pursuit.
For demonstration purposes the renderless components in this repository are a fully-functioning Halogen app. The /example
folder contains scaffolds for renderless components you can use to get started, and demonstrate the library helper functions in use.
yarn
will install everything you needyarn build
will build the project, which you can view atdist/index.html
Check out the contribution guidelines to get started and see helpful related resources.