Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Readme File - Invisible Reducer #42

wants to merge 3 commits into from

Conversation

Anisospina
Copy link
Contributor

Summary

  • Added Readme File

Screenshots

screen shot 2019-02-05 at 11 54 24

Trello Card:

https://trello.com/c/ski2UTqu/41-invisible-reducer-documentation

@mvbattan mvbattan self-assigned this Feb 11, 2019
@marianozicavo marianozicavo self-assigned this Feb 19, 2019
Copy link
Contributor

@marianozicavo marianozicavo left a 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 and createExternalActions, 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 😛

@@ -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/)
Copy link
Contributor

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

![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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an invisible reducer


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 👻.
Copy link
Contributor

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

In a few words, less work...


### Learn Redux-recompose
Copy link
Contributor

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


If you are not aware, we invite you to read [**Redux-recompose**](https://github.com/Wolox/redux-recompose)

### Installation
Copy link
Contributor

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).


### Example
Then use it in your app, already implemented redux, we add wrapCombineReducers:
```
Copy link
Contributor

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


By default, redux-recompose ships with a default invisible reducer that is the following:

```
Copy link
Contributor

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

import onFailure from '../../effects/onFailure';


// TODO: Let the user specify selectors
Copy link
Contributor

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


export const defaultActionNames = Object.keys(reducerDescription);

// TODO: Let user specify this initialState
Copy link
Contributor

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

@marianozicavo marianozicavo removed their assignment Mar 19, 2019
![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.

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.

// 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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

global state.

@mvbattan mvbattan removed their assignment Mar 13, 2020
@marianozicavo
Copy link
Contributor

marianozicavo commented Mar 18, 2021

Hola @Anisospina !
Está por salir la version 3.0 de redux-recompose y estamos revisando el estado los PRs abiertos.


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 3.0 hay un archivo recipes/INVISIBLE.md que tiene el link a un post explicando el reducer invisible y una demo de ejemplo. Si querés actualizar el PR, podés hacerlo en ese archivo.
De todas formas voy a pedirle a los otros chicos de react-native que lo miren para que den una opinión, ya que ellos son los que la usan en el día a día.


La forma de poner "al día" este PR si querés hacerlo es

  • cambiar la base branch del PR por la branch 3.0
  • solucionar conflictos y comentarios

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants