Closed josephr5000 closed 2 years ago
You either need to write it in its expanded form (like a class) so you can either add a parameterless constructor or a static method to create a default instance, or you could remove [FeatureState]
and add a class
public class MyStateFeature : Feature
Could you please elaborate a bit why we shouldn't use records? Is it because of #274 ?
Sorry, my bad. I missed the part about "expanded form". So I guess it's safe to use a record like this?
[FeatureState]
public record AuthState : LoaderStateBase
{
public bool IsAuthorized { get; init; }
public string UserName { get; init; } = "none";
}
Considering that these defaults are suitable.
Yes, you can also do this
[FeatureState]
public record AuthState(bool IsAuthorized, string UserName)
{
private AuthState() => new AuthState(false, "None");
}
Can I do this:
such that I could write a reducer: