Socket
Socket
Sign inDemoInstall

strudel-redux

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strudel-redux

Redux bindings for Strudel


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Strudel-redux

Package with Strudel component wrapper for combining Strudel with Redux.

Getting Started

This plugin provides simpler API for Redux with Strudel.

Installation

npm install strudel-redux --save

or

yarn add strudel-redux

Example

import { Component, Evt } from 'strudel';
import { Subscribe, AttachStore }  from 'strudel-redux';
import { toggleStockStatus } from '../../actions/';

@AttachStore(store)
@Component('.example')
class Example {
  init() {
    store.dispatch(toggleStockStatus());
  }
  
  @Subscribe({
    observed: state => ({ 
      price: state.productDetails.price,
    }),
    passive: state => ({
      stockStatus: state.productDetails.stockStatus,
    })
  })
  onPriceChange({ price, stockStatus }) {
    // put down your logic here
  }
})

API

  • @AttachStore(store) - required decorator to bind store to component.
  • @Subscribe: { observed: () => {}, passive: () => {} - decorator that makes subscription to the store. Decorated method is invoked with values returned from both observed and passive methods.
    • observed method that maps state to variables. Any change on one of these properties invokes decorated method.
    • (optional) passive method that maps state to variables. Any change to one of these properties doesn't invoke decorated method.

License

MIT

FAQs

Package last updated on 27 Nov 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc