r/programming • • Jun 19 '18

Airbnb moving away from React Native

https://medium.com/airbnb-engineering/react-native-at-airbnb-f95aa460be1c
2.5k Upvotes

581 comments sorted by

View all comments

149

u/GodGrabber Jun 19 '18

Redux is notorious for its boilerplate and has a relatively difficult learning curve. We provided generators for some common templates but it was still one of the most challenging pieces and source of confusion while working with React Native. It is worth noting that these challenges were not React Native specific.

Amen to that.

22

u/glassFractals Jun 20 '18

Has anyone used Rematch? It's an abstraction later built on top of Redux to try and account for some of its flaws. The pitch is that it's Redux (and API compatible), but with reasonable defaults and less boilerplate. I've been considering it because my interactions with Redux have been painful.

Medium article by the creator about why Redux needed improvement: https://hackernoon.com/redesigning-redux-b2baee8b8a38

→ More replies (1)

7

u/alamko1999 Jun 20 '18

One thing that confuses me was how to implement pub/sub on a component level, while connect automatically does that for you, there are some instances where i would want to fetch the network after an event. I just ended up using componentWillReceiveProps which is really ugly.

→ More replies (1)

60

u/LyeInYourEye Jun 20 '18

I love redux. I don't see what the problem is. Take a week and learn it? It seems to make sense to me.

94

u/[deleted] Jun 20 '18

I used redux for enough time to know that I spent way too much time typing and hopping around files for simple stuff.

54

u/aonghasan Jun 20 '18

But thanks to that it's so maintainable.

23

u/[deleted] Jun 20 '18 edited Jun 20 '18

I fully agree, but the amount of boilerplate is why I decided to go from "full stack" to solely backend. I want to spend my time on problems, not writing glue to piece the problems together.

2

u/IceSentry Jun 20 '18

What backend language are you using? Java is one of the worst when it comes to boilerplate.

2

u/[deleted] Jun 20 '18

Java is one of the worst when it comes to boilerplate.

Haha. I'm at a node shop -- there would actually be a lot of boilerplate to write if I was working on features, but right now my job is to write code that reduces boilerplate for other engineers, which is one of my favorite things to do. e.g. When someone starts writing a new route, they have a helper function that provides their error client, logger, hooks everything into our server automatically, etc. Right now it's a much more manual process.

→ More replies (1)

15

u/nirataro Jun 20 '18

VueX is the shit.

5

u/[deleted] Jun 20 '18

Yeah I tried to learn redux just playing around a bit with React and i was like what the fuck is this, it made no sense to me.

Vuex maybe took me a day or two to wrap my head around and quickly seemed natural.

2

u/[deleted] Jun 20 '18

To be fair, I think most redux tutorials out there suck and they often show you how to work with 4 other libraries at the same time. Redux itself is really really simple, it's more wrapping your head around the concepts than the code.

I'll check out Vuex today though.

→ More replies (1)

7

u/compubomb Jun 20 '18

Amen to that. I actually think Vuex makes so much more sense than redux. Redux to me always feels insanely verbose. And then how you have to tie it together feels just as strange.

3

u/VIM_GT_EMACS Jun 20 '18

VueX coupled with NuxtJS is my go to for work

→ More replies (3)

10

u/[deleted] Jun 20 '18

Redux makes complicated state possible to reason about. It does this at the cost of boilerplate, indirection and an awkward approach to async. I think I've only ever seen one Redux project actually justify these costs, and that was the article editing suite we wrote for reporters at The Guardian, back in 2015.

All the rest have been fairly trivial apps that could use React setState or possibly no client state at all.

2

u/d_rudy Jun 20 '18

That's the way I went for my most recent React apps, and only leaning on React Contexts for some stuff like user info and error handling that was needed in disparate components. I think a lot of people reach for Redux too quickly; it's definitely overkill for most projects I've seen it used in. Half the time, I'm happy to write my own state machine to do Reduxy things, just because I think Redux is over-engineering a lot of the time. That said, I won't write it off completely because I can definitely see the usecase for sufficiently complicated apps.

3

u/nomadProgrammer Jun 20 '18

Redux documentation (at least 1 year ago), was very complex and pompous. They should learn from Vue.js to give a better simpler documentation. Also it is full of boilerplate BS. Happy to no longer work with React or ReactNative Bs.

3

u/acemarke Jun 20 '18

I'm a Redux maintainer. Could you give some specific examples of what you're referring to?

I'm always happy to have people help improve our docs.

2

u/compubomb Jun 20 '18

I found a react-vuex workflow :)

0

u/[deleted] Jun 20 '18

[deleted]

→ More replies (2)

13

u/the_evergrowing_fool Jun 20 '18

The amount of boilerplate with no clear benefit.

I think the boiler is product of being ad-hoc and relaying too much on JS. It would be better as an DSL base on pattern matching.

14

u/JustinsWorking Jun 20 '18

There is a lot of clear benefit.

Great seams for tests, one directional data flow, rewind, and easy debugging via actions.

If you're not using any of those, I have no idea why on earth you're using Redux.

→ More replies (3)
→ More replies (5)

2

u/yes_u_suckk Jun 20 '18

I use MobX for state management and I find it much easier than Redux.

→ More replies (14)