Skip to content

4074/redux-use

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published