Comments (6)
Original author: Liam Doran @liam_doran
Original date: 2016-12-06T19:14:19Z
Thanks for doing this series! I had a question on the "Setting Up the Store and Reducers" section. Specifically, I'm having a hard time understanding the differences between your approach and redux-ORM's. They seem pretty similar for this specific case, other than the fact that you're generating the base reducer for the orm branch, and that your reducer could be made into a generic "update entity" reducer (like you do in Part 2.) Is that why you're doing it yourself here, or is there something else that I'm missing?
from marks-dev-blog-comments.
Original date: 2016-12-07T01:55:38Z
Hi, and thanks for the question! In the specific example I showed, there's not really any difference in actual behavior (which was kind of the intent). Overall, the main difference between using `schema.reducer()` (Redux-ORM's suggested approach) and "manually" setting up a reducer is that the `schema.reducer()` approach wants you to write all your reducer logic as part of your Model classes. There's not anything specifically _wrong_ with that, but it definitely puts more of an emphasis on the Models as the center of attention. In my case, I'm trying to keep the focus on my own reducer logic, and using Redux-ORM's capabilities as a helpful tool in that process. So, slight difference technically, slightly bigger difference philosophically, perhaps.
Having said that, Tommi Kaikkonen is close to releasing Redux-ORM 0.9, which will actually invalidate a large chunk of what I wrote in these two posts. For example, updates will be applied right away, so you won't have to do that `session.state = session.reduce()` trick I talk about in Part 2. Also, looking at the latest commit in the currently open pull request, the docs have changed and now recommend the "standalone reducer" approach instead, although it seems that "attached reducers" are still acceptable. The PR with the 0.9 features is at https://github.com/tommikai... if you want to look through it.
I definitely plan on writing a follow-up post on what's changed in 0.9 and how to use it after 0.9 comes out and I've had a chance to play with it a bit.
from marks-dev-blog-comments.
Original author: Liam Doran @liam_doran
Original date: 2016-12-08T14:24:34Z
Gotcha, that makes sense. I checked out the 0.9 PR, looks like he's doing some cool stuff, I'll look forward to your post on it!
from marks-dev-blog-comments.
Original date: 2016-12-07T01:55:38Z
Hi, and thanks for the question! In the specific example I showed, there's not really any difference in actual behavior (which was kind of the intent). Overall, the main difference between using `schema.reducer()` (Redux-ORM's suggested approach) and "manually" setting up a reducer is that the `schema.reducer()` approach wants you to write all your reducer logic as part of your Model classes. There's not anything specifically _wrong_ with that, but it definitely puts more of an emphasis on the Models as the center of attention. In my case, I'm trying to keep the focus on my own reducer logic, and using Redux-ORM's capabilities as a helpful tool in that process. So, slight difference technically, slightly bigger difference philosophically, perhaps.
Having said that, Tommi Kaikkonen is close to releasing Redux-ORM 0.9, which will actually invalidate a large chunk of what I wrote in these two posts. For example, updates will be applied right away, so you won't have to do that `session.state = session.reduce()` trick I talk about in Part 2. Also, looking at the latest commit in the currently open pull request, the docs have changed and now recommend the "standalone reducer" approach instead, although it seems that "attached reducers" are still acceptable. The PR with the 0.9 features is at https://github.com/tommikai... if you want to look through it.
I definitely plan on writing a follow-up post on what's changed in 0.9 and how to use it after 0.9 comes out and I've had a chance to play with it a bit.
from marks-dev-blog-comments.
Original author: ianastacio @ianastacio
Original date: 2017-02-11T08:55:10Z
Hi Mark, just a small note, Normalizr does have denormalization support since version 3.1.0 https://github.com/paularms...
from marks-dev-blog-comments.
Original date: 2017-02-11T18:53:24Z
Yeah, saw that. My comparison was accurate at the time of the original post :)
Glancing at the API docs, it looks like Normalizr's `denormalize()` function will do a complete load of the relevant object graph at once. That's not necessarily bad, but could be more than you really need done. On the other hand, Redux-ORM looks up relations in a somewhat lazier way, when you access the relation wrapper fields.
Still, it's a good addition to Normalizr, and I appreciate the pointer!
from marks-dev-blog-comments.
Related Issues (20)
- How Web Apps Work: AJAX, APIs, and Data Transfer HOT 4
- Blogged Answers: Why React Context is Not a "State Management" Tool (and Why It Doesn't Replace Redux) HOT 31
- Coding Career Advice: Using Git for Version Control Effectively HOT 3
- Presentation: JavaScript for Java Devs HOT 1
- Practical Redux, Part 11: Nested Data and Trees HOT 6
- Coding Career Advice: Searching and Evaluating Online Information Efficiently HOT 2
- Presentations: Learn Modern Redux Livestream HOT 1
- Blogged Answers: A Comparison of Redux Batching Techniques HOT 1
- Codebase Conversion: Migrating a MEAN AngularJS app to React, Next.js, and TypeScript HOT 1
- Blogged Answers: React, Redux, and Context Behavior HOT 3
- Idiomatic Redux: Designing the Redux Toolkit Listener Middleware HOT 10
- Presentations: Intro to React, Redux, and TypeScript (2020) HOT 1
- How Web Apps Work: JavaScript and the DOM HOT 4
- Reactathon 2022: The Evolution of Redux Async Logic HOT 4
- Blogged Answers: How I Estimate NPM Package Market Share (and how Redux usage compares to other libraries) HOT 1
- Presentations: Modern Redux with Redux Toolkit
- Blogged Answers: The Evolution of Redux Testing Approaches HOT 1
- Presentations: 2022 Podcasts
- Blogged Answers: My Experience Modernizing Packages to ESM HOT 10
- Practical Redux, Part 7: Form Change Handling, Data Editing, and Feature Reducers HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from marks-dev-blog-comments.