Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/laurencedorman/preact-classless-component
- Owner: laurencedorman
- License: mit
- Archived: true
- Created: 2016-04-27T21:50:11.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-02-11T20:37:12.000Z (almost 3 years ago)
- Last Synced: 2024-06-12T22:29:15.385Z (7 months ago)
- Language: JavaScript
- Size: 930 KB
- Stars: 44
- Watchers: 3
- Forks: 6
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-preact - Preact Classless Component - Create preact components without the class keyword. (Uncategorized / Uncategorized)
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