3 ms·
Redux is a very good example of this. If you watch the original talk or just understand primitives like Observables, you can realize that Redux almost isn't a l
by _hardwaregeek 7y ago
Redux is a very good example of this. If you watch the original talk or just understand primitives like Observables, you can realize that Redux almost isn't a library. It's basically a pattern. Where libraries are actually required is when you connect Redux to React, or need async actions. But even then it's not super hard to see how they work.
- acemarke 7y agoYep. The Redux core `createStore` function can be distilled down to about 25 lines [0], and the rest of the core lib can be added in another 75-ish [1]. I've seen Redux described as "a pattern with really good documentation", and there's some truth to that. On the other hand, we've put a _lot_ of work into React-Redux in particular [2] to make sure it's optimized and works well with React. As a side note, we have a new official Redux Toolkit package [3] that is our recommended approach for writing Redux logic. It includes utilities to simplify several common Redux use cases, including store setup, defining reducers, immutable update logic, and even creating entire "slices" of state at once. [0] https://blog.isquaredsoftware.com/2017/05/idiomatic-redux-tao-of-redux-part-1/#the-core-of-redux-createstore https://blog.isquaredsoftware.com/2017/05/idiomatic-redux-ta... [1] https://gist.github.com/gaearon/ffd88b0e4f00b22c3159 https://gist.github.com/gaearon/ffd88b0e4f00b22c3159 [2] https://blog.isquaredsoftware.com/2018/11/react-redux-history-implementation/ https://blog.isquaredsoftware.com/2018/11/react-redux-histor... [3] https://redux-toolkit.js.org https://redux-toolkit.js.org