1.0.10 • Published 4 years ago

lit-connect v1.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

LIT-CONNECT: Great and simple connect function to connect your components to redux-store

Installation

npm install --save lit-connect

Quick Start

All you have to do is export a connect function using applyConnect on your store

import { applyConnect } from 'lit-connect'

const store = createStore(...));
export const connect = applyConnect(store);

Now you are ready to use the connect function :)

Usage with connect()

lit-connect provides a connect function for you to connect your component to the store.

So now you can:

import { connect } from '<path-of-your-connect>'
import {LitElement, html} from '@polymer/lit-element';

class Test extends LitElement {...}

const mapStateToProps = (state) => {
  return {
    counter: state.counter
  }
}

const mapDispatchToProps = dispatch => { 
  return {
    onInit: () => dispatch(action) 
  }
}

export default () => 
  customElements.define('test', connect(mapStateToProps, mapDispatchToProps)(Test));
  // Name of the custom html element that should be defined

Every property returned from mapStateToProps() and mapDisptachToProps() is now added to the class properties and as soon as you change the state LitElement automatically re-renders the component.

Feel free to contact me at: boninsegna.omar@gmail.com for every concern

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago