Skip to content

Redux Connect HoC for Web Components. Also works for LitElement.

License

Notifications You must be signed in to change notification settings

realiarthur/lite-redux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lite Redux

Redux Connect for Web Components. Also works with LitElement.

Usage

The function that is exported from the package gets store as an argument and returns connect HoC, which you can use just like the standard Redux connect (e.g. react-redux). Simple usage looks like this:

import connect from "lite-redux";
...

connect(store)(mapStateToProps, mapDispatchToProps)(Component)

But it is more concise to make connect with store and use it everywhere in your project:

// store.js
import { createStore, combineReducers } from "redux";
import makeConnect from "lite-redux";

const reducer = combineReducers({ ... });

const store = createStore(reducer);

export default store;

export const connect = makeConnect(store);
// Component.js
import { connect } from "./store";

class Component extends WhatEver {
    ...
}

export default connect(mapStateToProps, mapDispatchToProps)(Component)

About

Redux Connect HoC for Web Components. Also works for LitElement.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published