1.1.2 • Published 2 years ago

redux-use v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

redux-use

NPM version

A easy way to use redux base on @reduxjs/toolkit and react hooks.

Usage

There are just 3 methods.

import reduxu from 'redux-use'

// async
const list = reduxu.async(
  //
  async () => {
    return fetch('path/to/load/list').then((res) => res.json())
  },
  {
    // As same as options of `@reduxjs/toolkit/createSlice`
    // name: string,
    // reducers: {},
    // extraReducers: (builder) => {}
  },
)

// sync
const listFilter = reduxu.sync({
  // As same as options of `@reduxjs/toolkit/createSlice`
  // name: string,
  // initialState: {}
  // reducers: {},
  // extraReducers: (builder) => {}
})

// Export the combianed reducer
export default reduxu.reducer()

Example

Run the todo app demo.

# example/server
yarn install
yarn start

# example/app
yarn install
yarn start

Sharing

img img img img img img img img

1.1.2

2 years ago

1.1.1

2 years ago

1.0.0

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago