1.1.11 • Published 5 years ago

hooco v1.1.11

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

hooco

React hooks & contextual API for apps binding.

import hooco from 'hooco'

export function Counter(state) {
    const {counter = 0} = state();

    function inc() {
        state({counter: counter + 1})
    }

    return {
      counter,
      inc
    };
}


export const {
    use: useCounter,
    Provider: CounterProvider,
    Consumer: CounterConsumer,
} = hooco(Counter)

/// ---- 

function App() {
  const {counter, inc} = useCounter();
    
    return <div>
        <h2>Counter: {counter}</h2>
        <button onClick={inc}>inc</button>
    </div>
}
1.1.11

5 years ago

1.1.10

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago