etch-stateless
etch-stateless is a library to facilitate creating Etch components from functions that take props and children and return JSX.
API
stateless(etch, renderFn)
etch
- an instance of the Etch libraryrenderFn(props, children)
- a function that takes properties and children and returns Etch-based virtual DOM nodes
Overview
If your Etch component doesn't manage any internal state, it can be useful to describe the component in terms of a function that takes some input and returns JSX:
const MyComponent =
The component will automatically re-render using the supplied function any time a parent calls the component's update
hook (which happens whenever new props or children are passed to the component).
Under the Hood
etch-stateless is simply sugar for a plain Etch component. For example,
const MyComponent =
is the same as:
{ thisprops = props thischildren = children etch } { thisprops = props thischildren = children etch } { return <div prop=thispropsmyProp>thischildren</div> }