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

react-context-api-store

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-context-api-store - npm Package Compare versions

Comparing version 1.0.12 to 1.0.13

25

lib/index.js

@@ -61,5 +61,5 @@ 'use strict';

return wantedState ? wantedState(_extends({}, storeState)) : {};
}, _this.mapActionsToProps = function (updateState, storeState) {
}, _this.mapActionsToProps = function (updateStore, storeState) {
return wantedMutators ? Object.keys(wantedMutators).reduce(function (accumulatedMutators, mutator) {
return _extends({}, accumulatedMutators, _defineProperty({}, mutator, _this.dispatcher(updateState, storeState, wantedMutators[mutator])));
return _extends({}, accumulatedMutators, _defineProperty({}, mutator, _this.dispatcher(updateStore, storeState, wantedMutators[mutator])));
}, {}) : {};

@@ -71,3 +71,3 @@ }, _this.render = function () {

function (context) {
return _react2.default.createElement(WrappedComponent, _extends({}, _this.mapStateToProps(context.state), _this.mapActionsToProps(context.updateState, context.state), _this.props));
return _react2.default.createElement(WrappedComponent, _extends({}, _this.mapStateToProps(context.state), _this.mapActionsToProps(context.updateStore, context.state), _this.props));
}

@@ -97,11 +97,12 @@ );

return _ret2 = (_temp2 = (_this2 = _possibleConstructorReturn(this, (_ref2 = Provider.__proto__ || Object.getPrototypeOf(Provider)).call.apply(_ref2, [this].concat(args))), _this2), _this2.state = _extends({}, _this2.props.store), _this2.persisted = false, _this2.updateState = function (updatedState) {
var newState = _extends({}, _this2.state, updatedState);
_this2.setState(newState);
return _ret2 = (_temp2 = (_this2 = _possibleConstructorReturn(this, (_ref2 = Provider.__proto__ || Object.getPrototypeOf(Provider)).call.apply(_ref2, [this].concat(args))), _this2), _this2.state = _extends({}, _this2.props.store), _this2.persisted = false, _this2.persist = function () {
if (_this2.props.persist !== false) {
_this2.props.persist.storage.removeItem(_this2.props.persist.key || 'react-context-api-store');
_this2.props.persist.storage.setItem(_this2.props.persist.key || 'react-context-api-store', JSON.stringify(newState));
_this2.props.persist.storage.setItem(_this2.props.persist.key || 'react-context-api-store', JSON.stringify(_this2.state));
}
}, _this2.updateStore = function (updatedStore, callback) {
_this2.setState(_extends({}, _this2.state, updatedStore), function () {
_this2.persist();
if (callback) callback(_this2.state);
});
}, _this2.render = function () {

@@ -112,3 +113,5 @@ return _react2.default.createElement(

state: _extends({}, _this2.state),
updateState: _this2.updateState
updateStore: function updateStore(updatedStore, callback) {
_this2.updateStore(updatedStore, callback);
}
} },

@@ -127,3 +130,3 @@ _this2.props.children

this.updateState(savedStore ? this.props.persist.statesToPersist(JSON.parse(savedStore)) : {});
this.updateStore(savedStore ? this.props.persist.statesToPersist(JSON.parse(savedStore)) : {});
}

@@ -130,0 +133,0 @@ }

{
"name": "react-context-api-store",
"version": "1.0.12",
"description": "An HOC state management inpired by redux implemented using react's context api.",
"version": "1.0.13",
"description": "Seemless, lightweight, state management library that supports async actions and state persisting out of the box. Inspired by Redux and Vuex. Built on top of React's context api.",
"main": "lib/index.js",

@@ -6,0 +6,0 @@ "scripts": {

Sorry, the diff of this file is too big to display

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