News for hackers. Stuff that matters.
Re:Show HN: 30 Days of React by Zombieball on Friday December 16, 2016 @01:43PM (#13195604)
I'd love it if a series like this was made where a React website and React Native app were made in tandem. Suggestions for project layout and architecture would show you how to reuse core business logic between both apps.

Perhaps even the view layers could have some overlap?

I currently work on a team that supports multiple native Android apps and an Angular 1.X web app. The ability to reuse code in this fashion is the biggest lure to React for me. I've seen a few blog articles that cover this topic at a shallow level. If anyone has resources they could share it would be much appreciated.

Re:Show HN: 30 Days of React by fourstar on Friday December 16, 2016 @03:53PM (#13196697)
https://github.com/este/este is what you want

Just git clone and start playing around with it. Great docs as well.

Re:Show HN: 30 Days of React by Zombieball on Friday December 16, 2016 @04:17PM (#13196932)
Awesome, I gave it a quick glance. This line from Readme makes me happy:

> code shared across platforms (browser, server, native mobile)

I'll definitely have to take a closer look. Thanks!

Re:Show HN: 30 Days of React by Longhanks on Friday December 16, 2016 @04:45PM (#13197163)
As someone who appreciates apps that tailor to each specific platform and respect that platform's unique features and guidelines, this scares me.
Re:Show HN: 30 Days of React by vincentriemer on Friday December 16, 2016 @05:01PM (#13197282)
React Native doesn't make it so you share UI code between platforms (https://facebook.github.io/react-native/docs/platform-specif...). What you get to share is all the business logic between tailored UIs.
Re:Show HN: 30 Days of React by clay_to_n on Friday December 16, 2016 @08:00PM (#13198347)
You can share UI code between platforms if you want, though!

At least Android + iOS. Some components are platform- specific but at least on a small simple app I've been successful sharing my UI code.

Re:Show HN: 30 Days of React by acjohnson55 on Saturday December 17, 2016 @02:50AM (#13199783)
I haven't yet done any React Native, but it seems to me that hypothetically, you can share or not share as you go down the component tree. I can imagine dedicated layouts per platform, then shared widget clusters, then dedicated low-level widget implementations.
Re:Show HN: 30 Days of React by Dibes on Sunday December 18, 2016 @02:39PM (#13207194)
Yup, there is an entry point for both the Android and iOS app. You can point to the same root component or a separate one if you want separate layouts orwhat have you
Re:Show HN: 30 Days of React by sb8244 on Friday December 16, 2016 @04:59PM (#13197270)
Is it possible for tooling to maintain a lot of these quirks and then implement additionally on top of areas it falls short?
Re:Show HN: 30 Days of React by bauser on Friday December 16, 2016 @03:10PM (#13196325)
@author here: What a great idea. I think that's something we can make happen in a future book.
Re:Show HN: 30 Days of React by Zombieball on Friday December 16, 2016 @04:13PM (#13196897)
That'd be awesome! I'll keep an eye out.
Re:Show HN: 30 Days of React by zackify on Friday December 16, 2016 @02:20PM (#13195928)
Not OP, fyi

If I only had more time... I'd love to write a guide on that. That really is a great idea!

I recently copied the entire state management part (done with redux) to a react native app and it just worked. Was a really cool thing to see. If I had RN in mind when I first made the site, it could have even more reuse.