Hi - What's the latest philosophy/best practices on interop with React web?
Is the philosophy still 'learn once write everywhere'? There are so many different approaches now to reuse React Native with React, like react-native-web and react-native-dom, it's confusing.
Some of those solutions are non-starters for me since I started with a React webapp and want to now have a React Native app that shares most of my existing code.
My gut feeling is just stick with HOCs, SFCs, proper isolation of the views and I'll be able to share the bulk of things like action creators, reducers, etc. Is this reasonable? Are there other good practices?
Your plan of sharing business logic sounds good. We don't currently have any recommended way to share code between web and iOS/Android, although I'm hopeful we will at some point in the future.
I'm actually curious - how does the React (Native) team feel about such efforts? Initially RN was pitched not for cross platform app development, but "learn once, write anywhere". I guess this is the reason why sharing more code between RN and web hasn't been prioritised by the FB RN team, but do you see your team wanting to encourage this?
For sharing code (even view code) between React Native and React web projects, also consider Microsoft's ReactXP project[1]. It is very actively developed and might be what you're looking for.
Have you used it? I saw it before but felt wary about having yet another layer above RN and React. I’ve been burned by taking on too many dependencies doing magical/black box things in the past...
Is the philosophy still 'learn once write everywhere'? There are so many different approaches now to reuse React Native with React, like react-native-web and react-native-dom, it's confusing.
Some of those solutions are non-starters for me since I started with a React webapp and want to now have a React Native app that shares most of my existing code.
My gut feeling is just stick with HOCs, SFCs, proper isolation of the views and I'll be able to share the bulk of things like action creators, reducers, etc. Is this reasonable? Are there other good practices?