I have a react-redux app and my team uses grpc-web. I'm wondering - what's the best way to design such system?
For now the plan is to create 3 abstraction levels:
- APImodule - promisified wrappers around- grpc-webclients
- Redux thunkslevel - async action creators that deal with the API
- React components props- will ask for only what component needs
So components know nothing about grpc, they mess with action creators, action creators know nothing about grpc, they deal with an api module, and only api module uses with grpc-web stubbs.
Reasons why I want to go this way:
- No grpc-specific code in action creators and components
- My Promise-based API instead of a callback-based API of grpc-web
My questions are:
- Is it a good idea to have an abstraction level between Redux and grpc-web? Or it's better to keep that stuff inside action creators logic?
- Is there a common design pattern I should think of? (I am thinking about "Adapter")
- Is it a good idea to promisify grpc-webAPI? If yes, is it a good idea to write a function and do it on the fly?
- Can I say that my current plan is Adapter Pattern?
- If I want to use an Adapter pattern, am I have to map every element of data collection to my own interface? I know that my components (and maybe action-creators) should not depend on grpc-webAPI because this API may change in future
 
     
     
    