Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-33.33%
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, dispatch } from 'strudel-redux';
import { toggleStockStatus } from '../../actions/';

@Subscribe({
  observed: state => ({ 
    price: state.productDetails.price,
  }),
  statics: state => ({
   stockStatus: state.productDetails.stockStatus,
  })
})
@Component('.example')
class Example {
  init() {
    this.dispatch(toggleStockStatus());
  }

  onStateChange({ price, stockStatus }) {
    // put down your logic here
  }
}

API

  • @Subscribe(store, callbackFunction) - required decorator to bind strudel-redux to component
  • onStateChange(properties) - added method called on change of properties declared as observed
  • callbackFunction: { observed: () => {}, statics: () => {} - functions that will return mapped state properties
  • observed method is called on store change, and will trigger onStateChange if returned value differs from previous
  • statics method is called whenever observed function will detect change, and provides additional props that does not trigger onStateChange call

FAQs

Package last updated on 07 Mar 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