3 ms·
By chance, I stumbled upon this same article a few weeks ago while re-learning React and learning Redux. I didn't get much out of the article since gripes 1-5
by rmrfrmrf 9y ago
By chance, I stumbled upon this same article a few weeks ago while re-learning React and learning Redux.
I didn't get much out of the article since gripes 1-5 are all solved by Redux, and 6 is a complaint about Redux having too much boilerplate.
It also seemed to me that mapStateToProps and mapDispatchToProps aren't given a fair representation in this article (especially with the "selector" pattern emerging within them). If your Redux store is denormalized already, then yes, mapStateToProps will seem quite redundant. However, if you're working with multiple sets of async data, it's much easier to organize your store by fetch method and denormalize inside mapStateToProps.
- acemarke 9y agoYep, and as I've said numerous times [0] [1]: you can use as much or as little abstraction on top of Redux as you want. Don't like writing action constants by hand? Use `redux-actions` to generate action creators that have an overriden `toString()`. Don't like touching multiple files? Use the "ducks" pattern. Want something that adds additional layers on top so you don't even have to touch the store? Use Kea or Jumpstate or Dva. Also, my own personal advice is that you should always use the "object shorthand" version of `mapDispatch`, and never actually write a real `mapDispatch` function by hand again: const actions = {addTodo, toggleTodo}; export default connect(mapState, actions)(TodoList); [0] http://blog.isquaredsoftware.com/2017/05/idiomatic-redux-tao-of-redux-part-2/ http://blog.isquaredsoftware.com/2017/05/idiomatic-redux-tao... [1] https://github.com/reactjs/redux/issues/2295 https://github.com/reactjs/redux/issues/2295
- pandeiro 9y agoHaving to use something like Redux, conceptually solid but so full of boilerplate, instead of re-frame is kind of like having to use Java at work instead of Clojure. Some of us are just lucky, I guess.
- tigroferoce 9y agoSo true. Some of us are lucky enough to use a concise language like clojure. I am really asking myself why lisp and functional programming in general are not really taught in schools.
- WA 9y agoI learned Scheme in my first semester of computer science (in Germany). Back then, I thought "What's this garbage? I want to program a game or a webapp, not some obscure stuff in a language I never heard of". I can appreciate the idea of teaching functional programming only after I graduated, but for starters, it seems too far away from what the industry, magazines and people talk about. That might be a reason why it's not taught at many schools.
- watwut 9y agoFunctional programming is taught in schools. Sometimes even with lisp. Students unvirsally seen it as impractical theory. The popular ressurection of functional on frontend is relatively new development. Before, it was used only in few math related areas.