Better HN
topnewbestaskshowjobs
Log inSign up

ikido

14 karma · joined Jan 14, 2016 (10y ago) · 9 submissions

Submissions

comment 8y ago · link · parent

While I don't think that posting solutions or using them is the right thing to do I'm grateful to the author for mentioning the course — it's fantastic!

comment 10y ago · link · parent

Very valid points addressed in this essay, I wonder if OS and messengers vendors will ever take that into account

comment 10y ago · link · parent

can you elaborate more why this approach is convoluted?

comment 10y ago · link · parent

Thanks, I'm actually working on it

comment 10y ago · link · parent

The concept of tracking data is actually quite simple — when you define some object property as observable it is replaced with a getter & setter that invoke a callback when you get/set that property. Then you can bind a function that will be called when data is changed (via setter).

You can also wrap some code into special autorun function, that will track what observable data was accessed, and when that data changes, that code will be called again.

But wait, there's more =) It works with arrays, objects and other types, check out the docs!

comment 10y ago · link · parent

That's a good point, but in Redux you subscribe to all changes in single state tree where all data lives. That means that every update of data (which has no upper limit) will cause your UI to re-render. Sure, you can implement shouldComponentUpdate, but still it will be called on every state update, plus you do can do exactly the same with mobx. The difference is that with mobx you subscribe to changes of certain data, and it happens automatically.

comment 10y ago · link · parent

No difference in how you handle routing and history in a regular React app, those things are not related. Mobx (and mobx-react) just re-renders your component when data changes. You can check out performance tests here: https://www.mendix.com/tech-blog/making-react-reactive-pursu...

comment 10y ago · link · parent

I know that a lot of people like to use different kinds of flux libraries for their React apps, with Redux having a lot of traction, but you should definitely look at Mobx.

We've introduced it to one of our project 4 months ago and our state management became as simple and easy as it should be with React. No boilerplate subscriptions, no helpers that modify normalized data, no endless re-renders on every state change and very easy to understand concept for new developers.

We literally stopped worrying about the state though it took some time to rewrite the app.

comment 10y ago · link · parent

Doesn't look very ergonomic — it's kind of hard to keep your hands in the air for a long time