Questions tagged [reselect]

Reselect is a selector library for Redux.

Reselect is a selector library which uses memoization. It was originally written to compute derived data from -like applications state, but it's not strictly coupled to any specific architecture/library.

Reselect keeps a copy of the last inputs/outputs of the last call, and recomputes the result ONLY IF one of the inputs changes. If the the same inputs are provided twice in a row, Reselect return the cached saved output.

Reselect's memoization and caching are fully customizable.


Resources

387 questions
0
votes
2 answers

React child component does not receive props on first load

I am fetching data in parent 'wrapper' component and pass it down to two child components. One child component receives it well, another does not. In container: const mapStateToProps = createStructuredSelector({ visitedCountriesList:…
0
votes
3 answers

When using Immutable.JS, should redux selectors always return Immutable.JS objects?

The Redux Team suggests selectors always return Immutable.JS objects .However, I find it's difficult for selectors to return Immutable.JS objects when selectors' returning objects are constructed by multiple slices of the state. Take the official…
Jason Xu
  • 845
  • 8
  • 22
0
votes
1 answer

react selectors, handle onload state and onclick together

I'm trying to understand selectors in react with ReSelect, it's ok for now but i think something wrong with my logic. 1 - After ajax request, i get a list of "categories", with id, name and selected 2 - I'm using this list to create tags, when i…
jacman
  • 191
  • 9
0
votes
1 answer

Component calls Reselect only at the first time it renders

I'm building Multiple Select component for user to select the seasons on the post. So use can choose Spring and Fall. Here I'm using reselect to track selected objects. My problem is that my reselect doesn't trigger one it renders at the first…
merry-go-round
  • 4,533
  • 10
  • 54
  • 102
0
votes
1 answer

Will the component re-rende if selectors change third time?

For this selector code: import { createSelector } from 'reselect' import { FilterTypes } from '../constants' export const selectFilterTodos = createSelector( [getTodos, getFilters], (todos, filters) => { switch(filters) { case…
JiangangXiong
  • 2,326
  • 1
  • 12
  • 14
0
votes
1 answer

Use entities only mentioned in input data in denormalize

I have reselect selector which gets rerendered every time any collection in redux store is changed, but I want it to change only when ids referenced in input data are changed. Is this possible with current denormalize function? The code is: // TODO:…
Goodmind
  • 453
  • 5
  • 5
0
votes
1 answer

ngRx/store Observable value not showing up in Angular template

I am using a pretty contrived set of examples from the ngRx docs to try and get started with a redux model for our Angular app. The code below works--all the actions fire and update the store correctly. I can see them in the redux dev tools and the…
indigo
  • 1,067
  • 4
  • 15
  • 26
0
votes
1 answer

reselect with modal and sorting

I started using reselect in my React Native project. I was looking for a way to work with derived data in a redux application that works with large sets of Contacts. I have a problem with sorting. My main contact list sorts by a numeric field named…
Guy
  • 12,488
  • 16
  • 79
  • 119
0
votes
1 answer

How can I create a redux selector for a state that does not exist yet

I'm finding my way around the Redux echosystem, and I came across the following sutuation: Suppose I have a React component which should be connected to a redux state part using a selector, but this part does not exist yet (undefined). So, when…
0
votes
1 answer

Define selector dynamically based on result previous selection

I have selector which gets current filter type from store (filterSelector). And 3 more, which filter entities from store using different logic, let's imagine that their names are smallEntitiesSelector, mediumEntitiesSelector, bigEntititiesSelector.…
ilyabasiuk
  • 4,270
  • 4
  • 22
  • 35
0
votes
0 answers

How can reselect createSelector be able to be treated as the data or array when it returns a function?

When we use the npm package reselect (with React), we may do export const someData = createSelector( objs, (objs) => { // ... }); and I think someData is actually a function? But inside of our Component's .jsx file, we could show it…
nonopolarity
  • 146,324
  • 131
  • 460
  • 740
0
votes
1 answer

Generate Array of Objects using Lodash from Redux Reducer in Selector for FlatList

if you don't know React etc, read here. Below is the same question but more related to React etc: I have severel Objects containing one sort of data: Prices: 'btc-usd' : 2640, 'ltc-usd': 40, ... Amount of Crypto: 'btc-usd': 2.533, 'ltc-usd': 10.42,…
Marcel
  • 105
  • 5
0
votes
2 answers

Why Redux use the term "Selector"?

The term "Selector" sounds quite confusing to me. In official doc Computing Derived Data. It makes sense to name the mapping procedure "select" cuz you are indeed filtering something. kinda "select a different piece of the redux store". But…
Hux
  • 1,427
  • 1
  • 9
  • 6
0
votes
1 answer

Multiple components using the same selector, reselect

I am using the reselect library. i have a lot of components which are each connected (in their stateProps) to a certain selector(implemented with reselect, lets refer to it as selector A). every time one of selector A's params(also selectors lets…
shahar taite
  • 462
  • 6
  • 11
0
votes
1 answer

Reselect selector function not executing

I'm trying to use reselect to select if a form is valid but the function that selects the validity never runs: import { createSelector } from 'reselect' import { getSelectedItems } from '../categories/Categories' const categoriesSelector = state =>…
BeniaminoBaggins
  • 11,202
  • 41
  • 152
  • 287