Git Product home page Git Product logo

Comments (5)

ellbee avatar ellbee commented on May 18, 2024

Hey @jvanleeuwen, sorry it took a while to get back to you, I am on holiday with no laptop(!). I think I see what you are trying to do, but it looks like your factory function is returning a new selector each time so you won't get the memoization benefit?

from reselect.

PSpSynedra avatar PSpSynedra commented on May 18, 2024

@jvanleeuwen, See reduxjs/react-redux#52 (comment) and reduxjs/react-redux#59 (comment). I think this direclty adresses your issue here. Also what ellbee said is correct. You will not get any memoization when creating a new selector every time you select the data from the state. Create the selector once and use it whenever needed.

As soon as reduxjs/react-redux#59 (comment) is merged, you could pass the created selector as part of the props of your component and use it in the mapsStateToProps function to select the memoized result of your selector.

from reselect.

jvanleeuwen avatar jvanleeuwen commented on May 18, 2024

@ellbee Thanks for reacting while on vacation ;)
@PSpSynedra @ellbee

Both you guys are correct. My example code was terrible ;)
I eventually solved my use-case with a HOC which I pass props and returns a mapStateToProps > Reselect based on these passed props.

Your idea of passing a selector in Props is pretty interesting. I will try that today

from reselect.

PSpSynedra avatar PSpSynedra commented on May 18, 2024

@jvanleeuwen, You are absolutely correct. I was completely ignorant to the parent prefix of the props parameter passed to the mergeProps function. The documentation does also make that pretty clear, sorry for the confusion.

from reselect.

jvanleeuwen avatar jvanleeuwen commented on May 18, 2024

Not a single problem, thanks for helping. This can be closed :)

from reselect.

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.