0.2.3 • Published 7 years ago

kubox-preact v0.2.3

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

kubox-preact

Kubox-preact allows you to integrate kubox as a status handler for applications created with preact.

format UMDsize
normal3.84kb
min1.76kb
gzip649 bytes

Apply it is simple 🤓, kubox-preact has 3 types of components:

  1. Provider : create state contexts
  2. Suscriber : access and subscribe to the changes given by the state context shared by Provider component.
  3. Consumer : access the state context shared by the component provider.

Provider

The Provider component allows you to create shared contexts for the components that it hosts.

ParameterTypeDescription
storeinstanceof Kuboxcontext to share
import {h} from "preact";
import {Provider} from "kubox-preact";
import store from "./store";
import App from "./App";

export default <Provider store={store}>
   <App/>
</Provider>;

Subscriber

The Subscriber component allows you to subscribe and access a store defined by the context of the Supplier component or by store property.

ParameterTypeDescription
selectstring , arrayallows you to select the subscription to one or more namespace of the state
storeinstanceof Kuboxallows you to ignore the context given by the Provider component and point to this property
import {h} from "preact";
import {Provider} from "kubox-preact";

export default <Subscriber>
     {(state, actions) => <input oninput={actions.inputWrite}/>}
</Subscriber>;

Consumer

The Consumer component allows access to a store defined by the context of the Provider component or by store property.

ParameterTypeDescription
storeinstanceof Kuboxallows you to ignore the context given by the Provider component and point to this property
import {h} from "preact";
import {Provider} from "kubox-preact";

export default <Consumer>
     {(state, actions) => <input oninput={actions.inputWrite}/>}
</Consumer>;

The Consumer component does not subscribe to the changes, as if the Subscriber component does

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.9

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago