question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Selector interface support

See original GitHub issue

Since 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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:19 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
dai-shicommented, Apr 3, 2019

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.

0reactions
theKasheycommented, Apr 13, 2019

🚀

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found