DEV Community

Discussion on: Five tips about React hooks

Collapse
 
lyrod profile image
Lyrod

Good article. With generics, you could get rid of those two interfaces Get and Update to use generic on ActionType to infer the payloas type depending to the Types.

I usually make an interface that map the type depending on an enum.

Collapse
 
lyrod profile image
Lyrod

An example in a code of mine

github.com/Kiyozz/papyrus-compiler...