Course lesson
Using TypeScript and Redux to Model the Different States of our Checkout Form
This lesson uses the excellent classnames library to apply different formatting to our checkout page based on the current state of our form. To model those states we use TypeScript's string literals, which are great for simple situations like this. This...
- Duration
- 2 min
- Access
- Free
- Transcript
- Available
This lesson uses the excellent classnames library to apply different formatting to our checkout page based on the current state of our form. To model those states we use TypeScript's string literals, which are great for simple situations like this. This lesson sets us up nicely for responding to all the actions generated by our checkout thunk, which we'll explore in the next lesson.
There's a great discussion here about when to use string literals over enums: https://stackoverflow.com/questions/49761972/difference-between-string-enums-and-string-literal-types-in-ts