Comments (3)
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.
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.
Cool! Look forward to hearing updates.
Feel free to drop questions about impl / expected behavior.
from redux-in-worker.
Related Issues (9)
- Benchmark with js-framework-benchmark HOT 4
- Usage with Redux toolkits defaultMiddleware and configureStore() HOT 4
- Using "connect" HOT 6
- Is it possible to import values from the store worker file? HOT 8
- Does not work with redux-toolkit (createAsyncThunk) HOT 1
- How to work with Next JS? HOT 5
- How to use redux-persist HOT 2
- Self is undefined HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redux-in-worker.