Code Monkey home page Code Monkey logo

Comments (3)

dai-shi avatar dai-shi commented on May 18, 2024

Would it be possible to move these selectors to a webworker as well?

I think so. I assume you mean to use those selectors in reducers.

Would Redux useSelector be able to import the selector from the webworker?

Hm, so you mean the selector functions you pass to useSelector are heavy?
In this case, it'd require quite a bit of refactoring: Do heavy computations in reducers / middleware in pure redux, and useSelector in react-redux should be lightweight. It's so-called de-normalization. Maybe not very typical in normal redux.

from redux-in-worker.

hirviid avatar hirviid commented on May 18, 2024

Thanks for the quick response!

Our state is normalized indeed. We have some heavy parts in the reducers, where a certain action needs to update several parts of the state. But the most heavy part is in the selectors though, where we combine and calculate data from the state before giving it to a component. So in our case I guess it would make sense to try to move the selectors to a web worker.

I will make a proof of concept. I'm also looking at https://github.com/HerbCaudill/react-redux-worker , it looks like the selectors you pass to useSelector run in the worker in that package.

You can close this question if you want, I'll come with an update later when I have time for the poc.

from redux-in-worker.

dai-shi avatar dai-shi commented on May 18, 2024

Cool! Look forward to hearing updates.

Feel free to drop questions about impl / expected behavior.

from redux-in-worker.

Related Issues (9)

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.