4 ms·
I've done a few client projects in the past using React Native. I get the appeal of having a "single" codebase for iOS and Android, but I absolutely detested us
by distantaidenn 6y ago
I've done a few client projects in the past using React Native. I get the appeal of having a "single" codebase for iOS and Android, but I absolutely detested using it.
I'm quite sure and aware of people that love it, but just from my personal development background, it just never really seemed appealing to me. Definitely not a fan of how state is handled. I've rolled my own system, Redux, and a host of other solutions as well. It just all seemed unnecessarily complex.
As you said, to me it just felt like hacks on top of hacks. I'll take vanilla iOS and Android development any day of the week, and twice on Sunday.
With that said, and from what I've seen of Dart/Flutter, I really hope it takes off.
- ledauphin 6y agocan you go into more detail about "how state is handled"? I wouldn't have considered that to be one of the offerings of React Native (or Flutter).
- distantaidenn 6y agoWell, for a toy app, it's pretty simple, but once you begin to build real-world apps, with 30 or 40+ components, and their children, I just found passing state and props around a bit messy and hacky. Of course, then you introduce Redux, and all is well. But now you have to deal with transducers and actions, and so on. I just didn't find the tradeoff worth it, and prefer native development. I'm sure every React developer has at some point found themselves banging their head on the wall trying to figure out why some child component isn't updating. And yes, it's a personal preference, but I'm also not a fan of Javascript. If another client wants a single codebase app, I'm really gonna give Flutter a nice long look. I've read the docs, and it looks quite appealing.
- tiborsaas 6y agoCheck out React context to avoid this property passing, which is annoying, I agree. Did you know that Redux is now basically built into React? https://medium.com/simply/state-management-with-react-hooks-and-context-api-at-10-lines-of-code-baf6be8302c https://medium.com/simply/state-management-with-react-hooks-... https://blog.logrocket.com/use-hooks-and-context-not-react-and-redux/ https://blog.logrocket.com/use-hooks-and-context-not-react-a...
- satvikpendem 6y agoIn contrast, https://www.simplethread.com/cant-replace-redux-with-hooks/ https://www.simplethread.com/cant-replace-redux-with-hooks/ https://daveceddia.com/context-api-vs-redux/ https://daveceddia.com/context-api-vs-redux/ https://medium.com/javascript-scene/do-react-hooks-replace-redux-210bab340672 https://medium.com/javascript-scene/do-react-hooks-replace-r... TL;DR Context can replace some but not all of Redux. Redux can figure out which components to rerender based on what's being computed. Context doesn't, so it's basically the same as refreshing your entire component tree every time something changes. You could build it yourself, but at that point, you're just reinventing Redux. I also like the Redux Toolkit (https://redux-toolkit.js.org/ https://redux-toolkit.js.org/) which is an opinionated way to write Redux that cuts down the boilerplate a lot. createSlice is easily one of the best features, you can encapsulate Redux logic for each different type of content, like authentication, users, posts, etc.
- acemarke 6y agoGlad to hear that RTK is working well for you! I'm currently working on updating the Redux core docs to teach RTK as the default way to use Redux. Hoping to have the new "Quick Start" tutorial page up in the near future.
- satvikpendem 6y agoFlutter has a few different state management techniques, and even a Redux implementation. Provider is the most commonly used one. For Redux with React, you could check out Redux Toolkit (https://redux-toolkit.js.org/ https://redux-toolkit.js.org/). It solves a lot of the boilerplate issues with Redux. createSlice is especially valuable.
- conradfr 6y agoNot sure why NativeScript and Ionic are not more popular on HN, I've seen more success with both of these than React-Native. I guess the first is not backed by a big company and the second still has the Cordova stigma.