|
| 1 | +# Scalable Frontend With Redux and Sagas |
| 2 | + |
| 3 | +This project is an attempt to address the problem raised at |
| 4 | +[slorber/scalable-frontend-with-elm-or-redux](https://github.com/slorber/scalable-frontend-with-elm-or-redux) |
| 5 | +by [@sebastienlorber](https://twitter.com/sebastienlorber). |
| 6 | + |
| 7 | +**Note:** The overall application and some code ( Components ) were copied over from |
| 8 | +Jaysoo's implementation - but the architecture is completely different between |
| 9 | +the two implementations. |
| 10 | + |
| 11 | +## Notable Differences |
| 12 | + |
| 13 | +One of the things I had to invent to make this architecture happen is the **LocalProvider**. |
| 14 | +This is a Provider higher order component that provides the store to all its children |
| 15 | +through the context. In this respect its quite similiar to the *Original* Redux Provider. |
| 16 | +The important difference is that it allows you to have *local* state maintained in a |
| 17 | +Redux store. There are multiple stores ( kind of a store hierarchy! ) but all dispatched |
| 18 | +actions are *listenable* at the global store. This allows local isolated modifications |
| 19 | +while also allowing *global* signalling mechanism. It works exactly |
| 20 | +the same as using *setState* but with the added benefit of being able to move any component |
| 21 | +from a local state to a global state with very few changes. |
| 22 | + |
| 23 | +## Downsides |
| 24 | + |
| 25 | +- The complete application state is not *currently* serializable ( atleast completely! ). |
| 26 | +- Its not possible to react to *local* changes in other *local* locations. |
| 27 | + |
| 28 | +## Running App |
| 29 | + |
| 30 | +``` |
| 31 | +npm install |
| 32 | +npm start |
| 33 | +``` |
| 34 | + |
| 35 | +Browse to [http://localhost:8080](http://localhost:8080), and see the |
| 36 | +"Real World" Example at the very bottom of the page. |
| 37 | + |
| 38 | +- The GIFs section allows you to add a GIF for the entered topic. |
| 39 | +- The toggle button can be *on* or *off*. |
| 40 | +- The counter can be *incremented* or *decremented*. |
| 41 | +- Whenever a new GIF is fetched (either by adding or requesting more), |
| 42 | + the counter is incremented by *1* if button is off or `counter < 10`, |
| 43 | + otherwise it is incremented by *2*. |
| 44 | + |
0 commit comments