Skip to content

A-gambit/focal-redux

Repository files navigation

Focal-Redux

npm Version License Build Status

Focal-Redux allows you to use all the power of Focal in a Redux application. It helps you to implement Focal's Atom in the Redux application by simplifying the code refactoring when you want to switch from Redux to Focal. Futhermore, you can use all the advantages of both state-management in your application. For example, Focal can help you with large collections of data or form management, and so on.

Installation

$ yarn add focal-redux

or

$ npm install --save focal-redux

Usage

First Step

You should wrap your Reducer or ReducersMapObject with subscribeAtom function. This function will automaticaly add action @@UPDATE_STORE@@ which will be dispatched when your atom updates.

import {subscribeStore} from 'focal-redux'

// Reducer:
subscribeAtom(reducer)

// ReducersMapObject
combineReducer(subscribeAtom({ //reducers }))

First Step

You should subscribe your atom to store using subscribeStore function:

subscribeStore(atom, store)

NPM scripts

  • npm start: Runs npm run build in watch mode
  • npm run test: Run test suite
  • npm run test:watch: Run test suite in interactive watch mode
  • npm run build: Generage bundles and typings
  • npm run lint: Lints code

Contributing

If you think that we are missing any key features, please open a GitHub issue, or even better, a pull request. Any feedback you have about using focal-redux would be greatly appreciated.