What, what do you have to follow up with that, Trevor? How do you feel about state management with React and GraphQL? Has it gotten easier than with, you know, rest is its difference. What do you think?
Yeah. I mean, I think that, you know, I'll reiterate what Phil said. I think that the React like React state hooks and context really go a long way. but there are certain cases where I've ended up using like a state management, state management with Apollo using like client side resolvers or like augmenting certain types in my GraphQL schema based on something, some value that I have stored in local storage with like, type policies. and those, those can just be an extra little bit of of, like the cherry on top of an already pretty good state management story, I think in present day.
Yeah. Vis, you got to follow up to that. How you feel about state management? Go off of, Phil and Trevor's answers that, context and using context. And like, traditionally we used to use local state, but then context came along and, we have pretty good hooks and also like, I've been using Apollo for straight state management mostly. So, big Apollo champion here for that. Cool.
What about you, Scott? How do you feel about the state management story with React and GraphQL? Oh, well, I feel like there's just more options than ever before, which is a good thing, but for me personally, kind of like what everyone said here, like I think the React team has did a really good job with the hooks and the context API, and I don't really find myself reaching for anything beyond those. So like, in the ecosystem, you know, I like to use, some of my favorite tools to use when interacting with APIs are things that support the, you know, swr, so still while revalidate, so packages like SWR from Vercel or React query, like those types of packages that pretty much support anything async are just very phenomenal because you can kind of mix and match, you know, data from an API versus local state, you can do all different types of things there. So I kinda messed with that and that's been really good so far. You know, it's been phenomenal. And then like, it also really just depends on like what framework you use and like when you're needed to make an API call. Right? So like if you're taking advantage of things like next JS that, you know, if you're using some of their server side functions, which only happen on the server, you don't really need a caching solution, right? It's happening on a server that code gets eliminated, you just make a simple fetch call, but if you're building a traditional spot, then yeah, you might want to invest in some type of. You know, context based hook based or even Apollo to manage that state, depending on how intricate your UI is, you might have to, you know, go for something like Apollo. Cause, uh, kind of like Trevor said, you might have to do some more optimizations on local storage and stuff like that. Uh, but I would say most of the time, if you get your back end correct and it's, you know, if you're back into doing the heavy lifting of sending exactly what your front end needs, you can kind of just get by with just the context and the hooks. Yeah. And I do like, I want to follow up on that, that I do love seeing kind of a wider landscape of these clients, uh, from anything to like the more smaller, uh, wider focused, um, you know, react query up to like a fully managed client. Like, uh, you have Urkel as well, which is also a really good solution. Um, so it's just really cool to see such a wide variety. I would say it's a little bit about like, yeah, thinking about the needs for your app and then playing around with them and seeing which one's kind of outside of that once you have that narrowed down, fit your, you know, your development style, team style, all that fun stuff. Uh, next question I want to get to, just cause I want to make sure we get to this and I've seen a couple of questions about this pop up. So I'm going to, uh, uh, uh, jump to this one, which is if there was one resource that you could recommend to folks, uh, who are wanting to get started with GraphQL and React, what would it be and, uh, Vish I'm gonna start with you this time if that's cool. Sure. Um, just going off of, um, how my experience has been learning GraphQL, I'd really suggest that just getting your fundamentals right with GraphQL first is very important.
Comments