Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
refract-redux-callbag
Advanced tools
Refract bindings for Redux with Callbag: master your app effects reactively!
Master your React and Redux app's effects through the
power of reactive programming.
Why? · Install · The gist · Learn · Contribute · Discuss
Refract lets you isolate your app's side effects - API calls, analytics, logging, etc - so that you can write your code in a clear, pure, and declarative fashion by using reactive programming.
Refract is an extensible library built for React, with bindings available for Inferno and Preact. In addition we provide a Redux integration, which can also serve as a template for integrations with other libraries.
Component-based architecture and functional programming have become an increasingly popular approach for building UIs. They help make apps more predictable, more testable, and more maintainable.
However, our apps don't exist in a vacuum! They need to make network requests, handle data persistence, log analytics, deal with changing time, and so on. Any non-trivial app has to handle any number of these external effects.
These side-effects hold us back from writing fully declarative code. Wouldn't it be nice to cleanly separate them from our apps?
Refract solves this problem for you. For an in-depth introduction, head to Why Refract
.
npm install --save refract-redux-callbag
Refract is available for a number of reactive programming libraries. For each library, a Refract integration is available for React, Inferno, Preact and Redux.
Available packages:
React | Inferno | Preact | Redux | |
---|---|---|---|---|
Callbag | refract-callbag | refract-inferno-callbag | refact-preact-callbag | refract-redux-callbag |
Most | refract-most | refract-inferno-most | refact-preact-most | refract-redux-most |
RxJS | refract-rxjs | refract-inferno-rxjs | refact-preact-rxjs | refract-redux-rxjs |
xstream | refract-xstream | refract-inferno-xstream | refact-preact-xstream | refract-redux-xstream |
import { compose, createStore } from 'redux'
import { refractEnhancer } from 'refract-redux-rxjs'
const reducers = combineReducers({
username: (state, action) => {
if (action.type === 'USERNAME') {
return action.payload
}
return state
}
})
const store = createStore(reducers, {}, compose(refractEnhancer()))
const usernameActions$ = store.observe('USERNAME')
const username$ = store.observe(state => state.username)
The Refract store enhancer adds an observe
method which takes a single argument (action type or store selector) and returns an observable. Read observing redux for more details.
Documentation is available at refract.js.org. We aim to provide a helpful and thorough documentation: all documentation files are located on this repo and we welcome any pull request helping us achieve that goal.
We maintain and will grow over time a set of examples to illustrate the potential of Refract, as well as providing reactive programming examples: refract.js.org/examples.
Examples are illustrative and not the idiomatic way to use Refract. Each example is available for the four reactive libraries we support (RxJS, xstream, Most and Callbag), and we provide links to run the code live on codesandbox.io. All examples are hosted on this repo, and we welcome pull requests helping us maintaining them.
We welcome many forms of contribution from anyone who wishes to get involved.
Before getting started, please read through our contributing guidelines and code of conduct.
The Refract logo is available in the Logo directory.
Refract is available under the MIT license.
Everyone is welcome to join our discussion channel - #refract
on the Reactiflux Discord server.
FAQs
Refract bindings for Redux with Callbag: harness the power of reactive programming to supercharge your components!
We found that refract-redux-callbag demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.