Questions tagged [reducers]

Refers to reducers in the mapreduce framework. Mappers split up a large problem and solve parts of it in parallel. Reducers collect and summarize the output of a map method.

Reference: https://en.wikipedia.org/wiki/MapReduce

819 questions
4
votes
3 answers

Difference between reduce task and a reducer

"a reducer is different than a reduce task. A reducer can run multiple reduce tasks". Can someone explain this with the below example? foo.txt: Sweet, this is the foo file bar.txt: This is the bar file and I am using 2 reducers. What are the reduce…
Arighna
  • 89
  • 2
  • 9
4
votes
2 answers

Redux reducer, check if value exists in state array and update state

So I've got an array chosenIds[] which will essentially hold a list of ids (numbers). But I'm having trouble accessing the state in my reducer to check whether the ID I parsed to my action is in the array. const initialState = { 'shouldReload':…
James111
  • 15,378
  • 15
  • 78
  • 121
4
votes
1 answer

mapreduce conditional probability

how to do probability aggregations inside my reducer with mappers; I'm trying to implement both the “stripes” approach and the “pair” approach on Hadoop for the following tasks but I'd like to know how to do communication among multiple mappers and…
4
votes
2 answers

Can reducers and mappers be on the same data node?

I have started reading about Big Data and Hadoop, so this question may sound very stupid to you. This is what I know. Each mapper processes a small amount of data and produces an intermediate output. After this, we have the step of shuffle and…
user2441151
  • 1,522
  • 3
  • 17
  • 26
3
votes
0 answers

best place to put the logic in a SRP way dealing with Redux sagas against Firestore,

Learning more about Redux Sagas and the Reducer pattern and want to ask for how to abstract my workflow in a sensible way. I have a backend Firestore collections of "tags" documents like this very simple. A Tag is a json object like {"name":…
Erik
  • 5,039
  • 10
  • 63
  • 119
3
votes
3 answers

Filtering an array using reduce

So I want to use Array.prototype.reduce function to reduce some array (converted from object). This is the object which I'll later use Object.entries to get the array. const activityLoading = { topicsForClassCourse: true, b: false, c: false, …
Duoro
  • 288
  • 1
  • 3
  • 14
3
votes
1 answer

How can I type a helper function parameter using WritableDraft from @reduxjs/toolkit?

I'm using @reduxjs/toolkit and I'd like to write a helper function for one of my slice reducers. Something I would call like this: reducers: { MY_REDUCER(draft, action) { helperFunction(draft); } } This would be the helper function: const…
cbdeveloper
  • 27,898
  • 37
  • 155
  • 336
3
votes
1 answer

Const variable as type - Typescript

During learning Typescript I faced problem when I used constant variable with the value of action which I use to reducer (created to prevent typo - I have read somewhere it is good practice). const INPUT_CHANGE: string = "INPUT_CHANGE"; const…
sqtr
  • 199
  • 1
  • 3
  • 12
3
votes
1 answer

Converting React useReducer to TypeScript

I am trying to convert a useReducer hooks to TypeScript, It's working fine as useReducer hooks, however not in TypeScript. Here is my code, import * as React from "react"; const JOKE_URL = "https://icanhazdadjoke.com/"; const initialState = {…
Mamunur Rashid
  • 1,095
  • 17
  • 28
3
votes
2 answers

React Redux Assign Arrow Function Warning in reducers

Can someone tell me why I'm getting this Warning in my React App? src/reducers/posts.js Line 3:1: Assign arrow function to a variable before exporting as module default import { FETCH_ALL, CREATE, UPDATE, DELETE } from…
Rastezzy
  • 49
  • 1
  • 7
3
votes
2 answers

What should be structure of Redux Store?

Redux.org tells to normalize your state but it creates some confusion. It tells that we should have State in following format: { simpleDomainData1: {....}, simpleDomainData2: {....}, entities : { entityType1 : {....}, …
Kiran
  • 2,147
  • 6
  • 18
  • 35
3
votes
1 answer

Typescript integration with complex redux actions and reducers

I'm new to typescript at the moment and I'm trying to combine it to redux actions and reducers. I'm getting an error right now and I want the best approach to refactoring the code. This was my method, and I need assistance. Action import Axios from…
3
votes
2 answers

Update redux reducer state

I want to update my content on same page, but after server update it shows old data Name : Arnold Schwarzenegger after i update my data Arnold Schwarzenegger to Schwarzenegger using redux-from, Its changed on server but it shows Arnold…
Harry Edward
  • 141
  • 2
  • 2
  • 14
3
votes
1 answer

How i can pass an object to an attribute of an object?

I have this code in reducer: export const getSerieSuccess = (state = INITIAL_STATE, action) => { return { ...state, isLoadding: false, serie: action.serie //action.serie is a object with id, name, genre e status } } I want…
Jose Alves
  • 142
  • 1
  • 10
3
votes
1 answer

How to use reduce-reducers with combineReducers

So, I'm trying to use some piece of state from one reducer in another reducer, and I looked for a solution and seems the package reduce-reducers does exactly that, buth here's my question ... I have the following rootReducer.js file where I import…
Ruby
  • 2,207
  • 12
  • 42
  • 71