-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Readme File - Invisible Reducer #42
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! 😀
I think we should make some changes.
- I think we need a link in the main README that leads here. The user will always read the main README first.
- The documentation needs to talk about
wrapService
,wrapReducer
andcreateExternalActions
, as those are the functions you use for invisible reducers. I think the concept of the IR is difficult to understand from an example alone. I would approach it by showing a "traditional" r-r reducer, then showing how you can improve it with an IR explaining step by step how to transform it. - I think the docs need to talk about what makes a IR preferable in some cases (always using the same service to do the same changes to the state, then you just couple the service with the reducer).
All this is just how I see it. I'd like to have more feedback on this PR to see if someone else thinks the same. @mvbattan mostly 😛
src/invisible/README.md
Outdated
@@ -0,0 +1,71 @@ | |||
![coverage](https://img.shields.io/badge/Coverage-92%25-E01563.svg) ![downloads](https://img.shields.io/npm/dw/redux-recompose.svg?colorB=99d000&label=Downloads&style=popout) [![supported by](https://img.shields.io/badge/Supported%20by-Wolox.💗-blue.svg)](https://www.wolox.com.ar/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add these shields in another PR, so we can separate that from the documentation
src/invisible/README.md
Outdated
![coverage](https://img.shields.io/badge/Coverage-92%25-E01563.svg) ![downloads](https://img.shields.io/npm/dw/redux-recompose.svg?colorB=99d000&label=Downloads&style=popout) [![supported by](https://img.shields.io/badge/Supported%20by-Wolox.💗-blue.svg)](https://www.wolox.com.ar/) | ||
# Invisible Reducer 👻 | ||
|
||
By using invisible reducer, repeating the same logic in each of the reducers is avoided. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an invisible reducer
src/invisible/README.md
Outdated
|
||
By using invisible reducer, repeating the same logic in each of the reducers is avoided. | ||
|
||
It is a extracting your cross-reducer logic, so this logic keeps isolated and reusable by our other reducers. Also, it keeps hidden from other reducers, so 👻. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is extracting
Also, it is kept hidden from other reducers
src/invisible/README.md
Outdated
In a few words, less work... | ||
|
||
|
||
### Learn Redux-recompose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this here, as the person reading this probably already knows r-r
src/invisible/README.md
Outdated
|
||
If you are not aware, we invite you to read [**Redux-recompose**](https://github.com/Wolox/redux-recompose) | ||
|
||
### Installation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I hadn't noticed we didn't have the installation instructions.
This should go in the main README (in another PR).
src/invisible/README.md
Outdated
|
||
### Example | ||
Then use it in your app, already implemented redux, we add wrapCombineReducers: | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use ```js
so github adds syntax highlighting to the code
src/invisible/README.md
Outdated
|
||
By default, redux-recompose ships with a default invisible reducer that is the following: | ||
|
||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as before, we need to add js
src/invisible/README.md
Outdated
import onFailure from '../../effects/onFailure'; | ||
|
||
|
||
// TODO: Let the user specify selectors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't show this TODO in the docs
src/invisible/README.md
Outdated
|
||
export const defaultActionNames = Object.keys(reducerDescription); | ||
|
||
// TODO: Let user specify this initialState |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't show this TODO in the docs
src/invisible/README.md
Outdated
![coverage](https://img.shields.io/badge/Coverage-92%25-E01563.svg) ![downloads](https://img.shields.io/npm/dw/redux-recompose.svg?colorB=99d000&label=Downloads&style=popout) [![supported by](https://img.shields.io/badge/Supported%20by-Wolox.💗-blue.svg)](https://www.wolox.com.ar/) | ||
# Invisible Reducer 👻 | ||
|
||
By using invisible reducer, repeating the same logic in each of the reducers is avoided. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
, we avoid repeating the same logic in each of the reducers.
src/invisible/README.md
Outdated
// Add here your reducers as usual. | ||
}); | ||
``` | ||
CombineReducers: utility from redux. This helps merge several reducers into a root one. Each reducer is part of the global state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
global state.
Hola @Anisospina ! Me parece que a la documentación del reducer invisible todavía le falta un poco de explicación de los items que comenté acá. En la branch de La forma de poner "al día" este PR si querés hacerlo es
|
Summary
Screenshots
Trello Card:
https://trello.com/c/ski2UTqu/41-invisible-reducer-documentation