react-epic
v0.0.2-1
Published
Featured Subscriber and HOC for React Components
Downloads
11
Readme
React Epic
Featured Subscriber and HOC for React & RxJS ✨🚀🤘👨🚀🐟🐠
Install
You can install React Epic by either using PNPM, Yarn or NPM:
# PNPM
$ pnpm add react-epic
# Yarn
$ yarn add react-epic
# NPM
$ npm add react-epic
What is React Epic?
React Epic is our attempt to integrate RxJS the easiest way into React without sacrificing the readability or bridging between React and Redux. By this way, you only have to write RxJS subscriptions (called Epics) then bind it to React and everything will run like a charm! 🌟
Our example, Tada ... :
const todos$ = new BehaviorSubject([])
lift(
todos$,
addTodo$,
(todos, newTodo) => todos.concat([newTodo])
).subcribe(todo$)
refetchTodos$.pipe(
mergeMap(() => ajax.get('/todos'))
).subscribe(todo$)
@WithRx(
({ todos$ }) => ({ todos: todos$ }),
({ addTodo$, refetchTodos$ }) => ({ addTodo: addTodo$, refetchTodos: refetchTodos$ })
)
export class Todos extends Component { ... }
This library was influenced largely by Dart StreamBuilder, Redux Observable and React Redux!
Documentation
For more information about documentation and FAQ, please visit our friendly Wiki!