redux-astroglide 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/createSelectorHook/index.es.js +17 -0
- package/dist/createSelectorHook/index.js +22 -0
- package/dist/createSelectorHook/index.umd.js +779 -0
- package/dist/index.es.js +14 -6
- package/dist/index.js +14 -6
- package/dist/index.umd.js +14 -6
- package/dist/plugins/index.es.js +33 -404
- package/dist/plugins/index.js +33 -404
- package/dist/plugins/index.umd.js +33 -404
- package/dist/plugins/persist/index.es.js +33 -405
- package/dist/plugins/persist/index.js +33 -405
- package/dist/plugins/persist/index.umd.js +33 -405
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Redux-Astroglide
|
|
2
2
|
|
|
3
|
-
#### Taking the pain out of state management by
|
|
3
|
+
#### Taking the pain out of state management by stuffing a huge package into a tiny API
|
|
4
4
|
|
|
5
5
|
Astroglide is a set of configuration and automation tools built on top of Redux Toolkit in order to provide the most succinct API with the least boilerplate possible. It's the easiest way to get up and running with redux state, and has the lowest mental overhead of any state management tool for React.
|
|
6
6
|
|
|
@@ -239,7 +239,7 @@ const slice = createSlice("Login", {
|
|
|
239
239
|
// Nav/slice.js
|
|
240
240
|
const slice = createSlice("Nav", {
|
|
241
241
|
isOpen: persist("", {
|
|
242
|
-
storageType: localStorage, // default localStorage, must
|
|
242
|
+
storageType: localStorage, // default localStorage, must provide { getItem(key):any, setItem(key, value):void } API (async not allowed)
|
|
243
243
|
}),
|
|
244
244
|
clickCount: set((value) => value + 1),
|
|
245
245
|
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createDraftSafeSelector } from '@reduxjs/toolkit';
|
|
2
|
+
import { useSelector, shallowEqual } from 'react-redux';
|
|
3
|
+
|
|
4
|
+
var makeSelectorHook = function makeSelectorHook(selector) {
|
|
5
|
+
return function () {
|
|
6
|
+
return useSelector(selector, shallowEqual);
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
var index = (function () {
|
|
10
|
+
// creates a redux selector and a react hook that produce identical results
|
|
11
|
+
var selector = createDraftSafeSelector.apply(void 0, arguments);
|
|
12
|
+
var hook = makeSelectorHook(selector);
|
|
13
|
+
hook.select = selector;
|
|
14
|
+
return hook;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export { index as default, makeSelectorHook };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var toolkit = require('@reduxjs/toolkit');
|
|
6
|
+
var reactRedux = require('react-redux');
|
|
7
|
+
|
|
8
|
+
var makeSelectorHook = function makeSelectorHook(selector) {
|
|
9
|
+
return function () {
|
|
10
|
+
return reactRedux.useSelector(selector, reactRedux.shallowEqual);
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
var index = (function () {
|
|
14
|
+
// creates a redux selector and a react hook that produce identical results
|
|
15
|
+
var selector = toolkit.createDraftSafeSelector.apply(void 0, arguments);
|
|
16
|
+
var hook = makeSelectorHook(selector);
|
|
17
|
+
hook.select = selector;
|
|
18
|
+
return hook;
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
exports["default"] = index;
|
|
22
|
+
exports.makeSelectorHook = makeSelectorHook;
|