react-native-web with existing web and mobile app

lets say you have a SPA web app with reactjs and a mobile app with react-native already with different state management and navigation across the two projects. you want to push for unified code between the two with react-native-web. how would you incrementally adopt react-native-web with these two projects. would you need a third project to develop net new features / interfaces in react-native-web where the interfaces are state and routing agnostic? this would be sort of a library that you use in your existing projects. or are you adding too much complexity at this point where its not worth it?
5 Replies
arcanereinz
arcanereinz15mo ago
Imo you're adding way too much complexity. The problem I usually see is not in the development phase but the debug and launch phase of a project where something isn't working and there's too many layers between you and the javascript or native code running on the hardware. Some problems require you to understand react or react-native very well in order to debug it properly. How much experience do you have with react and react-native?
cucaracha
cucaracha15mo ago
Across a few of us we have pretty good knowledge of react and react native.
Ramsay
Ramsay15mo ago
If the project was in Next.js you could use Solito for this https://solito.dev/ but I'm assuming it's not and in that case you would basically have to build something similar to it to work for your specific case which would probably not be worth it. For the creator of Solito, Fernando, it kinda makes sense for him since he is the only frontend developer of his startup so it makes sense to share all the frontend code to allow him to be more productive. But if you're on a team I think you're better off keeping them separate. For me I would never consider it unless the screens, features, and components of your web app and mobile app are exactly one to one which they rarely are.
cucaracha
cucaracha15mo ago
yea sadly there is no framework being used in this project. moving forward, the screens and features need to be exactly the same (probably not the case in reality but lets just assume). the problem im having is figuring out how this would be integrated into the two existing projects. would i basically have to create features in a third repo that uses react-native-web that are router and state agnostic and then import the features into each project? i'm still trying to figure out if this is worth the effort
arcanereinz
arcanereinz15mo ago
My concern in using any framework/library is whether it will stop being actively maintain unless your project is short lived or you're open to rebuilding from scrap a few years down the line. I've had many libraries that have been deprecated that forced me to fork and patch. The simplest is having a shared repo that stores common files and even then you'll have add some code that detects the platform and adjusts accordingly.