qkreltms / react-action-listener

Middleware, React hook which allows making side effect and listening actions of Context or Redux
MIT License
8 stars 0 forks source link

feat: implement middleware provider #30

Closed qkreltms closed 3 years ago

qkreltms commented 3 years ago

We are using middleware which on global level. Why don't we provide middleware using Provider?

<Provider middleware={middleware}>
  <App />
<Provider/>
qkreltms commented 3 years ago

It's the react-query way providing QueryClientContext It is worth referencing. https://github.com/tannerlinsley/react-query/blob/7bab9534cfb322f23a01549d464e0e618e204897/src/react/QueryClientProvider.tsx#L37

qkreltms commented 3 years ago

I've look up codes for a while and found that Provider needs only for useActionListener. So it may be verbose to apply.