Comments (5)
That's exactly what I do in react-tracked with useSelector
.
So, I don't want the duplication.
More importantly, this library is something that will be obsoleted when React provides a native solution. So, we shouldn't add a new feature.
If react-tracked doesn't fit for you (as it also has useTrackedState
), you might want to create a new library. (and list in https://github.com/dai-shi/use-context-selector#projects-that-use-use-context-selector)
from use-context-selector.
I created a draft PR here: #77
Open for further discussion!
from use-context-selector.
Cool, totally understand. I'll copy-paste this utility in my projects for now, especially since it's just a tiny file.
I'm looking forward to a native React solution! Are you referring to useMutableSource
, or some other API that I should be aware of?
I'm surprised React has been missing this feature for so long ... this library provides such a good performance-friendly, code-friendly API, that it really does need to be a native React feature.
from use-context-selector.
I'm referring to the useContextSelector
being experimented in React.
reactwg/react-18#73
from use-context-selector.
Oh, that's awesome to hear. I wasn't aware of this experiment; I will eagerly start watching for that! Thanks for the heads up.
from use-context-selector.
Related Issues (20)
- broken in react 18 HOT 7
- trigger other rerender use official demo
- Is it possible to create a strict context with this library? HOT 8
- [question] unexpected component render when first set different state HOT 4
- [question] Why is the scheduler dependency required? HOT 5
- Difference between this package and `@fluentui/react-context-selector` HOT 1
- Can you review my hook? (useKeyedContextSelector) HOT 2
- Don't work with react 18.2 HOT 10
- React Native: Crash occurs when using `createContext` and `MyContext.Provider` after updating to react-native v0.72 or later HOT 7
- Update occurs asynchronously after selection function runs HOT 1
- Version 1.4.2 specifies main module field that cannot be resolved HOT 16
- useMemo vs useContextSelector HOT 1
- Issue is back, missing some kind of export for react native. HOT 5
- `createContext` breaks tests with `@testing-library/react-native` and `vitest` HOT 3
- In useContextSelector(.., selector: (v) => ...) the argument v is not the valid context value type HOT 2
- I have a question about state rendering time HOT 2
- [Question] Getting several context values at once? HOT 7
- "useContextSelector requires special context" warning is never printed HOT 3
- `yarn compile` fails HOT 1
- The component doesn't redraw, but the component function is still executed HOT 8
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 use-context-selector.