redux-toolkit
redux-toolkit copied to clipboard
Docs: Add simpler Basic Usage example for createListener Middleware (suggestion)
I find the Basic Usage example way too convoluted and definitely not Basic. I suggest this is split into a very simple version for setting up and dispatching an action (I tried to keep it as simple as possible) and an extended version with some of the other options available.
I've also included another listener on the extended version.
P.S. Up to the team and the community to decide, but I find myself in trouble whenever I need to reach out for a very basic setup in order to implement a listener in my code.
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
Latest deployment of this branch, based on commit 17c73e49da26be9971de29bdd1a06ce5ac7710e0:
| Sandbox | Source |
|---|---|
| @examples-query-react/basic | Configuration |
| @examples-query-react/advanced | Configuration |
| @examples-action-listener/counter | Configuration |
| rtk-esm-cra | Configuration |
Deploy Preview for redux-starter-kit-docs ready!
| Name | Link |
|---|---|
| Latest commit | 17c73e49da26be9971de29bdd1a06ce5ac7710e0 |
| Latest deploy log | https://app.netlify.com/sites/redux-starter-kit-docs/deploys/679a6a585c13ca0008a01ddf |
| Deploy Preview | https://deploy-preview-4836--redux-starter-kit-docs.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Is your concern around the setup part (createListenerMiddleware(), getDefaultMiddleware.concat(listenerMiddleware.middleware)? Or the "things you can do inside the effect callback" part?
Mostly the effect callback contents. The setup part, is mandatory for a basic example, I guess.
For a basic example, I think, all the things inside the callback are a bit too much.