Redux InitialState with TypeScript

Redux with TypeScript: Focus on InitialState

John Boardman JavaScript, TypeScript 2 Comments

For this blog, I’m going to continue using the example project I’ve used for the last several blogs, Whirlpool. You can find my last post on the Keyhole Dev Blog – Updating Microservices with Netty, Kafka, and React: Whirlpool revisited. Feel free to go back and read about microservices, Netty, Kafka, and React, or just start here with me and continue on the journey. Either way, I’m glad you’re here.

The focus of this blog will be creating Redux’s InitialState using TypeScript. It tends to be tricky to get it to stop complaining about types, so this should be helpful. Personally, I’ve encountered this issue several times across multiple projects, so I think it is worth talking about.

Blazor Server in .NET 6 - Part 5 HttpClient

Blazor Server in .NET 6 – Part Five

Ryan Flachman .NET, Blazor, Blazor Server in .NET 6 Series, C#, Development Technologies, Tutorial Leave a Comment

In the final part of the Blazor Server in .NET 6 blog series, we covered how to use data binding and dropdowns with lists and enums. This included a short introduction to setting up an HttpService, making a get call to the API, and viewing the results as a string. For further clarity, I also included a demonstration on how to add an HttpService that uses the built-in .NET HttpClient class to make calls to the D&D 5e API!

Finally, I presented a way to add a dropdown with the available race options that our character can choose from. That concludes my five-part educational series on Blazor Server in .NET 6. I hope you enjoyed it, and learned a little something you can take with you. Thanks for tuning in!

Blazor Server in .NET 6 - Part Four - Blazor Components

Blazor Server in .NET 6 – Part Four

Ryan Flachman .NET, Blazor, Blazor Server in .NET 6 Series, C#, Development Technologies, Tutorial Leave a Comment

In Part 4 of the Keyhole Blazor Server in .NET 6 series, we covered adding events in our Blazor components. In sum, I demonstrated how to add a service that contains the events that components can listen to with methods to notify when to invoke our events.

After that, we added that service to the BaseComponent. The section is complete with adding the new character to our list of current characters in storage in order to notify all listening components of this event.

I hope you’re enjoying working with Blazor as much as I do so far. See you in part 5, the final part of the blog series, for how to use dropdowns and data binding using both lists and enums!

better sort in JavaScript

Better Sort Ordering in JavaScript

Lou Mauget Development Technologies, JavaScript, Programming, Tutorial Leave a Comment

In this post, I show how to cajole Array.sort() into producing the following order. This: [Item 1, Item 2, Item 100] instead of this…[Item 1, Item 100, Item 2].

The answer is to pass the sort function a comparator argument from the International Collator built into every major browser and Node.js. This approach is simple and declarative for lists of flat strings. The comparison function arguments default to each string being compared. For sorting objects such as a list of dropdown choices, just pass a pair of the sort field drill-downs to the comparison function.