redux-state-manage
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

redux-state-manage

Redux State Manage (RSM) is a solution for easy implements Redux in your project.

Open Source Love MIT Licence npm version npm downloads All Contributors


🚀 How use

Instalation:

npm install redux-state-manage
#or
yarn add redux-state-manage

Answer the questions (When choosing the tool, use the arrows keys to navigate, the spacebar to select and enter to finish)

🛠️ Utilization

For state handling, we will use useReduxState as a replacement for useState.

import { useReduxState } from 'redux-state-manage';

const App = () => {
  const [state, useMutateState] = useReduxState('stateName', 'initialValue');

  return (
    <div>
      <h1>{state}</h1>
      <button onClick={() => useMutateState('stateName', 'new value')}>Change state</button>
    </div>
  );
};

For fetching data, we will use useReduxFetch as a replacement for useEffect.

import { useReduxFetch, useMutateFetch, fetcher } from 'redux-state-manage';

const App = () => {
  // the id is unique for each request
  const { data, error, isLoading } = useReduxFetch(
    "http://localhost:3333",
    "data",
    fetcher
  );

  return (
    <div>
      <h1>{data} - {error} - {isLoading}</h1>
      <button onClick={() => useMutateFetch('http://localhost:3333', 'data', fetcher)}>Change data</button>
    </div>
  );
};

The two main methods were inspired by useState and SWR, using redux as the state manager.

📝 Contributing

Your contribution to the redux-state-manage is essential for the evolution of the project, you can do it as follows:

  • Open an issue to clear doubts, report bugs or give ideas
  • Open a pull request to give ideas for code improvement, implementation of new features and bug fixes

These are just some of the ways you can contribute to the project read the CONTRIBUTING for more information

🧑 Authors


Wesley Araújo

✨ Contributors

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

📄 License

redux-state-manage is a open source project licensed as MIT.

/redux-state-manage/

    Package Sidebar

    Install

    npm i redux-state-manage

    Weekly Downloads

    0

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    16.2 kB

    Total Files

    25

    Last publish

    Collaborators

    • wesleyara