4 ms·
I tried to go the old-school route of server rendered pages. But then I thought to myself: I would need to write an API later so that's double the amount of wor
by sergiotapia 5y ago
I tried to go the old-school route of server rendered pages. But then I thought to myself: I would need to write an API later so that's double the amount of work. What if I'm also going to make a mobile app?
I can spin up a graphql API, use create-react-app, and react native, use apollo client to share lots of code and be done with it.
The alternative is more "pure" I guess but it's a lot of double work.
- bmeski 5y agoWhy not just have a function that makes a db call and then send the data into the template? If a mobile app needs to request the same data, simply make a .json version of the route and use that same little db access function, shove the return into res.json({}) and Tada. Sharing ui code between react native and web-react is pointless so you'd be sharing what? some formatting functions? the request functions that the .json and ssr routes effectively return for you?