kamponent

1.0.1 • Public • Published

kamponent

a component for creating react components 🏃

This library is not released yet

Installation

npm:

npm install kamponent --save

yarn:

yarn add kamponent

Example 1

<Kamponent pure initialState={{ count: 0 }}>
    {({ state, setState }) => {
        return (
            <div>
                <h3>{state.count}</h3>
                <button onClick={() => setState({ count: state.count + 1 })}>+</button>
                <button onClick={() => setState({ count: state.count - 1 })}>-</button>
            </div>
        );
    }}
</Kamponent>

Example 2

<Kamponent>
    {({ props }) => {
        return (
            <div>
                <h3>{props.count}</h3>
                <button onClick={() => props.increment()}>+</button>
                <button onClick={() => props.decrement()}>-</button>
            </div>
        );
    }}
</Kamponent>

props

Property Type Working
children function or array or object Yes
initialState object Yes
pure bool Yes
didMount function Yes
didCatch function Yes
willUnmount function Yes
shouldUpdate function Yes
didUpdate function Yes
snapshotBeforeUpdate function Yes

params in functions

note: you can access to this parameters from functions and children (if it be function).
Property Type Working
state any Yes
props any Yes
setState function Yes
forceUpdate function Yes

Package Sidebar

Install

npm i kamponent

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

19 kB

Total Files

8

Last publish

Collaborators

  • alirezavalizade