1.0.0 • Published 11 months ago

@duckness/react-redux-pool v1.0.0

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

@duckness/react-redux-pool

@duckness/pool + React-Redux

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

Example

import React, { Suspense } from 'react'
import ReactDOM from 'react-dom'
import Pool from '@duckness/pool'
import ReactReduxPool from '@duckness/react-redux-pool'

import CounterDuck from './ducks/CounterDuck'

const App = React.lazy(() => import('./components/App'))

function RootComponent() {
  return (
    <Suspense fallback="Loading...">
      <App />
    </Suspense>
  )
}

const CounterPool = ReactReduxPool(
  Pool({
    buildStore: ({ initialCounter = 0 } = {}) => {
      return { counter: initialCounter }
    }
  }),
  RootComponent
)
CounterPool.addDuck(CounterDuck)

ReactDOM.render(CounterPool.render(), document.getElementById('counterApp'))

Table of Contents

API

Create ReactReduxPool

const myPool = ReactReduxPool(
  pool, // @duckness/pool to use with React
  renderRootComponent // root component
)

.render()

Return root component wrapped in Redux <Provider>. Render will build pool store if store was not built.

myPool.render()
// => <Provider store={pool.store}>{renderRoot(pool.props)}</Provider>

Pool methods

ReactReduxPool forward Pool calls to included Pool

const myPool = Pool()
const myReactReduxPool = ReactReduxPool(myPool, () => null)

myReactReduxPool.addDuck
// => myPool.addDuck
myReactReduxPool.build
// => myPool.build
myReactReduxPool.store
// => myPool.store
myReactReduxPool.setErrorReporter
// => myPool.setErrorReporter

Examples

https://github.com/hitosu/duckness/tree/master/stories

@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.5

4 years ago

0.5.4

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

0.2.7

4 years ago