Selector interface support
See original GitHub issueSince many people are interested in the selector interface, I start thinking about it.
from there: https://github.com/dai-shi/react-hooks-easy-redux/issues/3#issuecomment-477992639
We shouldn’t track the state usage in selectors. We don’t need to track it if only the result is important. That brings me an idea to provide another hook, which is much like something many have been discussing.
const Pair = props => {
const prevValue = useRef(null);
const mapState = state => {
const { value, name } = state[props.sliceId][props.pairId];
const direction = value > prevValue.current ? "up" : "down";
return { value, name, direction };
};
const { value, name, direction } = useReduxStateMapped(mapState);
useEffect(() => {
prevValue.current = value;
});
return (
It works somewhat magically. Closures are fine.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:19 (7 by maintainers)
Top Results From Across the Web
gshute.util Interface Selector
A Selector is an object that can select a value from an object. It has a single method getValue() that returns the value...
Read more >Selector (Java Platform SE 7 ) - Oracle Help Center
A selectable channel's registration with a selector is represented by a SelectionKey object. A selector maintains three sets of selection keys: The key...
Read more >CSS selectors - Learn web development | MDN
In this article we've introduced CSS selectors, which enable you to target particular HTML elements. Next, we'll take a closer look at type, ......
Read more >Selectors API Level 1 - W3C
The following features are defined in the DOM Level 3 Core specification [DOM-LEVEL-3-CORE]: Document interface. DocumentFragment interface.
Read more >About Selectors - UiPath Documentation Portal
To automate specific actions in the user interface, you are required to ... Full versus Partial Selectors ... Support for Salesforce Lightning Interface...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My current implementation of
useReduxStateMapped
has several issues: (1) there is no performance benefit. (2) it doesn’t yet work without external memoization. (3) it can’t deal well with multiple selectors/conditional usage.All right, let me start over. Please be patient. The good news is now that I have better understanding of your requirement.
🚀