All Questions
161 questions
1
vote
1
answer
46
views
React component will not update when using redux and createSelector, not detecting UI changes
I created a selector of users in a group in my immutable redux state:
import { useStore } from 'react-redux';
import { createSelector } from '@reduxjs/toolkit'
const selectGroup = (state) => state....
0
votes
2
answers
113
views
Redux data not rerendering when setting value within object (Immutable.js)
I have an immutable.js Map stored in Redux that is structured like:
reduxObject: {
details: {}
...
objectToChange: {
myPosts: [{
name: 'someName',
link: 'someLink',
...
0
votes
0
answers
361
views
React/Redux - getting json data from fetch request gives undefined for property in response body
I have a fetch request where I am getting a data object that has an items array in it.
export const getItems = (searchString: string, limit?: string, offset?: string) => (dispatch: ThunkDispatch) =&...
2
votes
4
answers
160
views
How to make a promise object immutable when setting different states in Javascript?
I'm working with React/Redux and want to use the same Promise result to set two different states. Here's my code:
useEffect(() => {
fetchData().then((resp) => {
Object.freeze(resp);
...
-1
votes
1
answer
201
views
How to delete nested element in map Immutable.js
I have the following structure in my redux case:
initialState: SearchState = fromJS({
isFiltersPanelOpen: false,
sections: {
type: { Course: {
isSelected: false,
...
1
vote
1
answer
2k
views
Wait for react state/props to update before using data?
I am using react-redux with persist-store in my react app. Once the user logs in, the state contains user data i want to use to customize the app and display their name and other info. It works ok ...
2
votes
1
answer
9k
views
Why does React/redux state reset on refresh?
When i login, everything works fine but the moment i hit refresh or navigate somewhere else, the state gets reset. Any idea why? I want to be able to reference the user from the state and get info ...
0
votes
1
answer
72
views
loop immutablejs Map object inside react render function
Basically i am using react redux and immutablejs. i am wrapping fromJS from immutable in my reducer which looks like this
const initialState = fromJS({
data1: {},
});
export default function ...
1
vote
2
answers
557
views
Benefit of using createSelector when there is only one parent selector
Suppose we have a simple redux store:
{
user: {
age: 10
}
}
And we have a selector to get user:
const getUser = state => state.get('user') // suppose we used immutable.js
now we have ...
3
votes
2
answers
1k
views
How to use combineReducers with handleActions
I'm trying to create new reducer survey, which must combine name and questions reducers while using handleActions from redux-actions package. But I recieve an error Invariant Violation: Expected ...
1
vote
1
answer
689
views
Remove last element of array in Redux with immutability-helper without knowing array's length
I am using immutability-helper (https://github.com/kolodny/immutability-helper) to update state in Redux actions. I have an array and I'm adding an element like this:
update(state, { modalAlerts: { $...
0
votes
0
answers
425
views
Should I convert immutable Map object to plain JS object?
We are using immutable.js module in our react-native project. Snippet of our reducer is given below.
const initialState = Map({
key: "",
});
export default function xyzReducer(state = ...
0
votes
1
answer
35
views
Import get method from immutable but cannot read in my selector
I used Immutable JS in my react project and I want to use get method in my selector file but it failed to recognize by my "getAllAppointments" and "getQuery" functions.
import {createSelector} ...
2
votes
0
answers
224
views
rehydrate draft-js EditorState with redux-persist
I use draft-js in my React app, and I use redux-persist to rehydrate my state stored in localStorage.
I need to store my EditorState in my redux store, because storing the ContentState is not enough ...
1
vote
2
answers
2k
views
How to compare two redux store states?
I am writing tests for my reducers and would like to compare state before dispatch to state after - actually 'substract' before state from after state
describe('UpdateAccountData', () => {
let ...