3 ms·
> However, a major drawback of this method is the lack of descriptiveness. When you see the dispatch function in your props, you don’t know the actions that you
by bfrydl 8y ago
> However, a major drawback of this method is the lack of descriptiveness. When you see the dispatch function in your props, you don’t know the actions that you can invoke and you need to make reverse engineering. It would be avoided if we had passed each callback directly as a prop.
It's worth mentioning that if you use TypeScript, it is possible to strongly type your dispatch function to only accept valid actions. In fact TS is smart enough to type check the individual properties of different actions based on the string value of the `type` property.
You can use that with the new React Context API mentioned at the end of the article to build yourself a strongly-typed, self-contained mini redux and react-redux alternative.