Today's snack is all about learning State management in GraphQL.
If you are used to a state management library like Redux, then using Apollo Client with GraphQL as a replacement will seem daunting.
Redux allows us to easily add a new state to manipulate data on the front end.
Here is a snippet for how we can define local-only fields, i.e. new fields on the GraphQL type, and extend the Server Type with a field that will only resolve on the client. This field means nothing to the Server, and the Server won't even know about it.
For example, the field `stockText` below is a local-only field that will only resolve on the client side. InMemoryCache is the equivalent of Redux but with GraphQL server data added on top.
There is a lot more to state management that this snippet can cover, so take a look at this detailed blog post on how we can use Apollo Client for State management. I'm drawing comparisons with Redux.
|You can continue to read this here
Great Black Friday Deals for Developers
James Quick recorded an excellent video for the top Black Friday deals for developers! Check it out here. I recently released an e-book on helping developers grow into engineering leaders, which also made it to the video. 😇
tRPC gives you inferred type safety, so you don't need to create complex Types, and it will infer that for you. This makes me very excited.
I am excited to announce that my most popular Mentoring program is 50% OFF for a limited time. You'll love my mentoring program if you want to level up in your career or brainstorm ideas to grow as a technical and professional developer.
|I'd like to check it out
Here is what a developer Stella that I grew from a Senior Developer to a Staff Developer, had to say, 😇
I also offer a free trial if you are interested.
|Check it out here
That's all for today, I'll talk to you soon.