3.0.0 • Published 4 years ago

reduken v3.0.0

Weekly downloads
12
License
ISC
Repository
github
Last release
4 years ago

Discontinued in flavor of Redukers

We have decided to evolve this package but with a completely new concept of only reusable reducers and selectors. You can read more about this idea in the Redukers repo. You can still use this package but it won't be maintained any longer.


Reduken

Generic redux reducers, actions and selectors.

Downloads Version License Dependencies Size

Set-up with React & Redux

  1. Install reduken
    npm install reduken
  2. Set up redux reducers

    import { combineReducers } from 'redux'
    import { entities, hash, list, requests, enableBatching } from 'reduken'
    
     export default enableBatching(combineReducers({
       entities,
       hash,
       list,
       requests
     }))

Modules

Also one utility available

Full Example

import React from 'react'
import ReactDOM from 'react-dom'

import { createStore, combineReducers } from 'redux'
import { connect, Provider } from 'react-redux'

import { entities, hash, list, requests, enableBatching } from 'reduken'
import { set, getFromPath } from 'reduken/hash'

// 1. Create store with the reduken reducers
const rootReducer = combineReducers({
  entities,
  hash,
  list,
  requests
})
const store = createStore(enableBatching(rootReducer), window.__INITIAL_STATE__)

// 2. Presentational Component
const HelloComponent = ({ name, handleChange }) => {
  return (
    <div>
      <h1>Hello {name}</h1>
      <input type="text" onChange={handleChange} value={name} />
    </div>
  )
}

// 3. Decorate component with connect
const HelloDecorated = connect(
  state => ({
    name: getFromPath('session', 'name', state) || 'World'
  }),
  {
    handleChange: event => set('session', 'name', event.target.value)
  }
)(HelloComponent)

// 4. Render the app
ReactDOM.render(
  <Provider store={store}>
    <HelloDecorated />
  </Provider>,
  document.getElementById('root')
)
3.0.0

4 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.25

6 years ago

1.0.24

6 years ago

1.0.23

6 years ago

1.0.21

6 years ago

1.0.20

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago