The short answer: Reference: https://stackoverflow.com/a/52486921/17360 The long answer: React overrides the native Javascript onChange behavior. Triggering an onChange event does nothing to change the input field value in React’s eyes. To React the value is still unchanged, even though to a user the value can clearly be seen on the screen. The above code triggers…
Category: Code
When to Use The FromService Attribute
I recently discovered the [FromServices] attribute, which has been a part of .Net Core since the first version. The [FromServices] attribute allows method level dependency injection in Asp.Net Core controllers. Here’s an example: Why use method injection over constructor injection? The common explanation is when a method needs dependencies and it’s not used anywhere else,…
C# 8 – Nullable Reference Types
Microsoft is adding a new feature to C# 8 called Nullable Reference Types. Which at first, is confusing because all reference types are nullable… so how this different? Going forward, if the feature is enabled, references types are non-nullable, unless you explicitly notate them as nullable. Let me explain. Nullable Reference Types When Nullable Reference…
9 Guidelines for Creating Expressive Names
Naming is subjective and situational, it’s an art, and with most art, we discover patterns. I’ve learned a lot through the reading of other’s code. In this article, I’ve compiled 9 guidelines I wished others had followed when I read their code. When a software engineer opens a class, she should know, based on the…