fynx-decorators

Fynx decorators for class-based React components.

Usage no npm install needed!

<script type="module">
  import fynxDecorators from 'https://cdn.skypack.dev/fynx-decorators';
</script>

README

Fynx is an architecture library for React. The fynx-decorators module provides store decorators for class-based React components.

Gitter Slack

license - MIT Dependencies

NPM status

Build status Coverage status

Install

With NPM

npm install fynx-decorators

With Bower

bower install fynx-decorators

From source

git clone https://github.com/foss-haas/fynx-decorators.git
cd fynx-decorators
npm install
npm run dist

API

connect(store, name):Decorator

Creates a React decorator that updates the component's props by setting the prop identified by name to the store's value whenever the store's value changes.

Automatically adds the store's current value to the component's initial props.

Registers the listener on componentDidMount and unregisters it on componentWillUnmount.

connectProp(propName, name):Decorator

Creates a React decorator that updates the component's props by setting the prop identified by name to the value of the store in the outer prop propName whenever the store's value changes.

Automatically adds the store's current value to the component's initial props and reacts to outer prop changes.

Registers the listener on componentDidMount and unregisters it on componentWillUnmount.

License

The MIT/Expat license. For more information, see http://foss-haas.mit-license.org/ or the accompanying LICENSE file.