Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/laurencedorman/preact-classless-component

A utility method to create preact components without using class keyword
https://github.com/laurencedorman/preact-classless-component

Last synced: 2 months ago
JSON representation

A utility method to create preact components without using class keyword

Awesome Lists containing this project

README

        

# Preact Classless Component
[![npm](https://img.shields.io/npm/v/preact-classless-component.svg)](http://npm.im/preact-classless-component)
[![travis](https://travis-ci.org/laurencedorman/preact-classless-component.svg?branch=master)](https://travis-ci.org/laurencedorman/preact-classless-component)
[![Dependency Status](https://david-dm.org/laurencedorman/preact-classless-component.svg?style=flat)](https://david-dm.org/laurencedorman/preact-classless-component)
[![devDependency Status](https://david-dm.org/laurencedorman/preact-classless-component/dev-status.svg?style=flat)](https://david-dm.org/laurencedorman/preact-classless-component#info=devDependencies)

If you use the [Preact](https://github.com/developit/preact) library, but don't want to use the `class` syntax because you've read articles by [Eric Elliott](https://medium.com/javascript-scene/a-simple-challenge-to-classical-inheritance-fans-e78c2cf5eead#.a3ako7xx9) and others that have lead you to favour object composition over class inheritance, then this utility is for you.

### Installation

```
$ npm install --save preact-classless-component
```

### Usage

```js
/* ES6 Modules */

import createComponent from 'preact-classless-component';

/* CommonJS */

const createComponent = require('preact-classless-component');

const Component = createComponent({
render(props, state) {
return (


Hello world!

);
}
});

```

### Acknowledgments

Thanks to [Jason Miller](https://github.com/developit) for his help on debugging this function.

### License

MIT