Created
February 9, 2022 21:14
-
-
Save Clancey/73ad82df48165c89c2f2dbc0f84379e2 to your computer and use it in GitHub Desktop.
Comet without any INPC/Bindings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RideTheComet : View | |
{ | |
public record CometRide | |
{ | |
public int Rides { get; init; } = 0; | |
public string CometTrain => "☄️".Repeat(Rides); | |
} | |
State<CometRide> state = new CometRide(); | |
[Body] | |
View body() => new VStack { | |
new Text(()=> $"({state.Value.Rides}) rides taken:{state.Value.CometTrain}"), | |
new Button("Ride the Comet! ☄️", () => state.Value = state.Value with {Rides = state.Value.Rides + 1}) | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment