redux-phoenix-middleware
Declarative automatic bidirectional maping between Redux Actions and Phoenix Channel Messages
Example
; const phoenixReducer = ;const phoenixMiddleware = ; // Keeps a log of messages sent to the `lobby` roomconst messagesReducer = { // Got a channel event, could've been sent like `broadcast!(socket, "message", %{ ... })` if actiontype === return state; return state;}; const store = ; // Somwhere else: const state = store; === 'open'; // or 'closed' === 'joined'; // or 'closed', 'errored'
Install
yarn add redux-phoenix-middleware