007 — Context is King
E8

007 — Context is King

Ryan:

Hey. How's it going? This is Ryan Hefner, and this is the All Play Podcast. So this week, I've been thinking about context a lot, and it's definitely been influenced through the whole debates that were going on on Twitter last week or last weekend regarding, you know, Laravel versus, React or React or React Remix or whatever. I mean, I guess I kind of fall on both sides of that debate for sure.

Ryan:

I can definitely appreciate and acknowledge all the niceties that come with working within Laravel. But, you know, on the opposite side, I feel like it is a bit of a slippery slope as soon as you start introducing React as far as, like, if that is how is if that's what you want to use or need to use to build the app that you're working on. The pairing of those 2, at least within, like, the same project I mean, I know that Inertia exists, and there are demos of pairing, Laravel with, like, a Next app. It still feels kinda clunky. I don't know what's going on with it.

Ryan:

And maybe it's just with the way that I like to set up my Laravel projects. For me, I typically like, some of the first things I do when I get into a Laravel project is I update the routing of the API. I'd like to I typically like to have that sit at a subdomain versus that slash API. I just think that gives you a lot more flexibility. And for me, I don't know.

Ryan:

It's just cleaner. It also means that if for the for whatever reason, if you want to start playing around with a different stack, you can, you know, just start swapping out whatever, you know, whatever, service or, app you have running at API, you know, dot your domain. And I don't know. It just seems it seems cleaner to me than having everything under the same domain and then having a bunch of subdirectories. But, you know, that also typically with the Laravel projects I've worked on in the past is, if I was working on I actually have done it both ways.

Ryan:

I've had it to where, you know, I've had some sort of tenancy setup that is using subdomains so, like, the app kinda lives at the tendency level and each, each account can have have their own, you know, unique subdomain. I've also just done the slash app thing. But when you start doing that, like so for instance, in the slash app scenario, that would typically be the React app would live there. And then I would also a lot then I would, like, use React router to handle, you know, deep linking within that app subdirectory. And then just I don't know.

Ryan:

Having to then especially if you wanted to have good, fast, you know, no spinners on that when that React app spins up, doing all of the predictive preloading of the JSON data that would use to hydrate that app with depending on the state of the route that it's in within Laravel to seem kind of annoying, which, you know, the story there in the next world is you would either I mean, it also depends on, which routing technique you're using. But, like, in the pages routing world, I mean, mostly I most of the apps, I've actually my personal ones, I've just been using the static routing, which is rad because everything just generates on build and is super, super fast when you're navigating it. But, for the client stuff, I use the get server side props for all the dynamic stuff. And, actually, I use my library that I wrote called next proper, so next dash proper. And that allows you to basically compose, a series of handlers that can then go and request whatever data you need for the page and then throws throws that into to the props.

Ryan:

And I don't know. It makes it really composable. Downsize there or the downside for that approach is at least within the next world, there's a lot of just copy and pasting pretty much like the same get server side props across whatever pages you're using. It's not horrible. You could also do some, you know, wild card deep wild card optional, slug stuff if you wanted to kinda minimize that and then just handle some view stuff there.

Ryan:

There's a lot of different options depending on how you wanna structure your app, but that does make it a lot cleaner, at least in my mind as far as dealing with the React side of things. I mean, really for Next, I I use it mostly just for the routing. Obviously, there's the get server side props. The fact that it has the server side rendering all out of the box, That's that's my go to there. But, yeah, it's you know, it when I guess that it just just goes back to these debates that people have, whether they're kicking off a project or working on an internal one and trying to figure out what the next move is or what the the best thing is.

Ryan:

All these different questions and trade offs you have to do. And at the end of the day, it's just really trying to figure out what works best for you. And for me right now, I'm trying to figure out context and trying to remain as productive as possible and not have to contact switch as much. The fact that both of the clients that I'm working for right now that, you know, the majority of the work is actually in Next Apps means that any of my personal projects that I'm working on, if I can continue to just work within the the scope or context of Next and React, then that's gonna be a whole lot easier for me to try to remain somewhat sane as I'm juggling these things. And even though I'm context switching between projects, I don't have to necessarily context switch between languages or, you know, the friction of trying to get multiple projects to work together.

Ryan:

That's also and then, you know, regarding my personal projects, thinking about local first, thinking about progressive web apps, all that stuff, the the story of a traditional app with a traditional request life cycle as you're navigating pages, it just starts to break down. So I'm not even sure. I know that there is a, I think, I believe, a a Laravel PWA, package. I'm not sure how well it supported. I think I looked last time I looked at it, looked like it had a lot of dust on it.

Ryan:

Might just it might have been back at the Laravel let me see here. Let me see if I could find it. Maybe, like, Laravel 5 days. 583. So, yeah, the demo is running Laravel 583.

Ryan:

I think Laravel's at 11 now. Who knows? They might be releasing 12 today. I mean, that that they've definitely been picking up the pace, over there. And so, yeah, it's just interesting.

Ryan:

And, actually, regarding the whole Laravel versus React thing, I think I was listening to, How About Tomorrow podcast with Taylor Otwell, and I think they really got down to the the basics of what's going on there. I mean, you can't really compare Laravel and, like, React Remix. That'd be like comparing you could only really if you wanna do a comparison, you'd be basically taking the Laravel router and blade and then comparing that with, like, React or Remix. I mean, maybe a few other little pieces, but it's just not really it's not really comparison. I mean, most React apps are typically being written against an existing API.

Ryan:

So yeah. I mean, there's that. There's also actually, it's it's there's an issue that's plaguing one of my apps right now, and I'm actually gonna be changing the, w w w to just be a a Next app and isolating the actual Laravel app under a app to subdomain because it's being basically, like, kinda like DDoS right now, and it has been since February. And it's one of those wild ones where it's more it's like an application layer attack. So essentially, I have this thing running on a $5 DigitalOcean box, but it dynamically you know, it's a it's a, disconnected service that basically allows me to dynamically generate Open Graph images from the from the like, for my projects that I work on.

Ryan:

But because it's being DDoS, the, it's just not behaving as consistent as it used to be. So I also do think that from a stability or resources standpoint, sometimes having these things a little bit fragmented can save you in that regard. So I'm gonna throw up a static site for the marketing, which will just be the next app. I'm gonna throw the actual Laravel app under an app subdomain, and hopefully, that will free it up so that it runs a little bit better. But, yeah, I've gone long on this one.

Ryan:

I thought it was gonna be a short one just regarding context and context switching and just even the concept of the context that's when someone is introduced to an idea or is having a conversation. I mean, all that context matters. So context really is king, and, we'll leave it there. So I'm Ryan Heffner. This is the All Play Podcast.

Ryan:

Please like and subscribe. No. This isn't YouTube. Subscribe, leave a review, or rating. Hopefully, it's an okay one.

Ryan:

You can follow me on Twitter @ryanhefner . You can follow the show @allplayfm. You can check out the site, allplay.fm, and my personal site, ryanhefner.com. Alright. Have a great one.

Ryan:

Later.