31 ms·
React Native + Next.js definitely has appeal to me. However, I'm not sure how future proof this API is. Unless I'm missing something, it looks like it locks you
by Benjamin_Dobell 5y ago
React Native + Next.js definitely has appeal to me. However, I'm not sure how future proof this API is. Unless I'm missing something, it looks like it locks you into data fetching at component render time. Facebook have been working hard in recent years to move away from that (<Suspense />) and routing libraries like React Location (https://react-location.tanstack.com/ https://react-location.tanstack.com/) offering asynchronous routing APIs seem like more promising approaches long-term.
- Andrex 5y agoBeen away from React from two years and this stuff is all-new to me. Maybe I'll wait another few years for it to settle down before looking again...
- blankface 5y agoupvote! lmao!!!!! foreal man
- fernandorojo 5y agoThose kinds of implementation details won't be hard to add to Solito. The API I'm using is that of Next.js. If they adapt to suspenseful approaches to routing, Solito will too. There are also experiments in the works to make React Navigation lazy load code with suspense on the Native side by bringing Webpack to Native: https://github.com/EvanBacon/expo-auto-navigation-webpack https://github.com/EvanBacon/expo-auto-navigation-webpack Another added bonus of this approach is that it will have a pages/ folder API like Next.js. I don't see why Solito won't be able to support these use-cases as they arise.
- Benjamin_Dobell 5y agoThat's fair, you're limited by the technologies you're using. I guess that's a problem with these sorts of libraries, you can find yourself being "the lowest common denominator". Of course, your library is very useful, and there are plenty of apps that I imagine can just drop in Solito. So this isn't at all to detract from its real-world value today. However, as much as it's convenient to get up and running (with bundle splitting), the file-system based router is in my opinion probably the weakest part of Next.js. It would be top priority on my list of things to go. The main issue is it's fundamentally not type safe. For example, Solito's useParams() is fragile because refactoring can easily cause param substitution to come out of sync with param consumption (in another component). My most recent solution (not in Next.js) for this is: const {partnerId} = useRouteParams(routes.tails.partner); That's 100% type-checked. Creating a URL for that route is also type checked and done like: routes.tails.partner({partnerId: "blah"}); I'd really like to see routing libraries adopt type safe practices. EDIT: I suppose the file-system based routing could be kept if you pair it with code generation. Maybe that's an option?