Coder Social home page Coder Social logo

Comments (3)

simondell avatar simondell commented on June 3, 2024

I don't have a whole answer for you, only one part.

Your reducer is mutating some of the state, instead of recreating it all. You have this line:

updatedWinnings.claimed[indexOfWinningInClaimed].isPending = false

... which changes the value of isPending on one item from a collection. However, you are not then making a new item with the new property value; you are returning the same item with the value mutated. Also, you are not returning a new .claimed array; only the same array with one property of one member changed. Because of this, the store->selectors->connect()->props->shouldComponentUpdate() sections of the component lifecycle will (probably) not notice that updatedWinnings.claimed[indexOfWinningInClaimed] has changed.

You could try modifying this reducer to make a new updatedWinnings.claimed array, with a new [indexOfWinningInClaimed] item, with the new .isPending value.

My preference would be to extract more and more specialised reducers. The one you have now operates on the collection. Make a new one which operates on an item in the collection (handling any actions it may need). You might need to go deeper still if the other data in updatedWinnings.claimed[indexOfWinningInClaimed] is rich and nested.

from redux-actions.

simondell avatar simondell commented on June 3, 2024

(This is likely not a problem with redux-actions. You might get better answers if you ask again on StackOverflow with a [redux] tag. However, redux-actions can help you: its handleActions() function makes it much easier to create layers of reducers with pass smaller and smaller pieces of state, and the action, to one another.)

from redux-actions.

tonoyandev avatar tonoyandev commented on June 3, 2024

@simondell thanks, yes that was not related to redux-actions. Closed.

from redux-actions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.