1.0.0 • Published 11 months ago

@duckness/use-pool v1.0.0

Weekly downloads
39
License
MIT
Repository
github
Last release
11 months ago

@duckness/use-pool

React hook for @duckness/pool.

NPM License Libraries.io dependency status for latest release, scoped npm package GitHub issues vulnerabilities npm bundle size

Example

import React from 'react'
import usePool from '@duckness/use-pool'

import CounterPool from './CounterPool'
import CounterDuck from './CounterDuck'

export default function Counter() {
  const counter = usePool(CounterPool, CounterDuck.select.counter)
  return <span>[ {counter} ]</span>
}

Table of Contents

Shortcut to @duckness/use-redux

@duckness/use-pool is a shortcut to @duckness/use-redux.

See @duckness/use-redux documentation for details.

import useRedux, {
  useDispatchAction as useReduxDispatchAction,
  useDispatch as useReduxDispatch,
  connect as useReduxConnect,
  combineSelectors
} from '@duckness/use-redux'

export default function usePool(pool, selector, shouldUpdate, shouldSelect) {
  return useRedux(pool.store, selector, shouldUpdate, shouldSelect)
}

export function useDispatchAction(pool, actionCreator, payloadTransformer) {
  return useReduxDispatchAction(pool.store, actionCreator, payloadTransformer)
}

export function useDispatch(pool, dispatcher, deps) {
  return useReduxDispatch(pool.store, dispatcher, deps)
}

export { combineSelectors }

export function connect(pool, selector, shouldUpdate, shouldSelect, dispatch = pool.dispatch) {
  return useReduxConnect(pool.store, selector, shouldUpdate, shouldSelect, dispatch)
}

@Duckness packages:

1.0.0

11 months ago

0.10.0

1 year ago

0.9.0

3 years ago

0.8.1

3 years ago

0.8.0

3 years ago

0.7.5

3 years ago

0.7.4

3 years ago

0.7.3

3 years ago

0.7.2

3 years ago

0.7.1

3 years ago

0.6.11

3 years ago

0.6.10

4 years ago

0.6.9

4 years ago

0.6.7

4 years ago

0.6.6

4 years ago

0.6.5

4 years ago

0.6.4

4 years ago

0.6.3

4 years ago

0.6.2

4 years ago

0.6.1

4 years ago

0.6.0

4 years ago

0.5.4

4 years ago

0.5.5

4 years ago

0.5.2

4 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.4.4

4 years ago

0.4.1

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.0

4 years ago

0.3.5

4 years ago

0.3.4

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago