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

delux-react

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

delux-react

React bindings for Delux

  • 1.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-25%
Maintainers
1
Weekly downloads
 
Created
Source

Delux-React

Delux bindings for React

import Store, {Collection} from 'delux';
import React from 'react';
import {ConnectedComponent} from 'delux-react';

class myComponent extends ConnectedComponent {
  static get collections () {
      return ['images'];
  }
  render () {
    return <div>{JSON.stringify(this.state.images)}</div>;
  }
}

let store = new Store ();

store.images = new Collection({});

<Provider store={store}>
  {connect(myComponent, ['images'])}
</Provider>

Features

  • Simple React-Redux inspired syntax
  • Extendable connected components

API Reference

Provider

Provider wraps connected components to the store.

Create a Provider
<Provider store={store}></Provider>
Description

The Provider is a React component which pass your store to it's child component through context.

Props
  • store - Delux store to provide to the child component
ConnectedComponent

Creates React Components connected to the store.

Create a connected component
// ES6

class MyComponent extends ConnectedComponent {
    //...
}

MyComponent.collections = collectionNames;

// ES6 static getter

class MyComponent extends ConnectedComponent {
    static get collections () {
        return collectionNames;
    }
    //...
}

// ESNext

class MyComponent extends ConnectedComponent {
    static collections = collectionNames;
    //...
}
Parameters
  • collectionNames - Store collections the component uses.
ConnectedComponent Instance
State

The state of the component is unified with the state of the selected collections.

Methods

dispatch()

Store#dispatch alias

Testing

in /delux-react:

 $ npm test

open /test/test.html with a modern browser.

Keywords

FAQs

Package last updated on 04 Oct 2016

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